dart_date 0.0.8 copy "dart_date: ^0.0.8" to clipboard
dart_date: ^0.0.8 copied to clipboard

outdated

An inmutable date manipulation library. dart_date provides a comprehensive, simple and consistent toolset for manipulating and parsing Dart dates in pure Dart (to be used in Flutter/Mobile, Web, Serve [...]

example/dart_date_example.dart

import 'package:dart_date/dart_date.dart';

main(List<String> args) {
  const pattern = "'Heute ist' dd-MMMM-yyyy";
  final n = Date.now();
  final d = Date.now().format(pattern, "de_DE");
  final x = Date.parse(pattern, d, locale: "de_DE");
  print("$d ($x)"); // Heute ist 30-November-2018 (2018-11-30 00:00:00.000)

  // ES language is pre-configured;
  print(Date.now().subDays(100).timeago(locale: 'es')); // hace 3 meses
  print(Date.now().format('MMMM dd y, h:mm:ss a')); // November 30 2018, 9:14:29 PM
  print(Date(2006, 6, 6, 6, 6, 6, 6, 6)); // 2006-06-06 06:06:06.006006 // UTC-5
  print(Date(2006, 6, 6, 6, 6, 6, 6, 6).UTC); // 2006-06-06 11:06:06.006006Z // UTC
  var now = Date.now(); // 2018-11-30 21:25:21.092647
  var closest = now.closestTo([ //2018-11-28 21:25:21.025275
    n.nextWeek,
    n.previousDay.previousDay,
    n.previousWeek.nextDay,
    n.nextMonth,
    //n.nextDay,
    //n,
    n.nextYear
  ]);
  print("Closest to now ($now): $closest (${closest.timeago()})");
  // Closest to now (2018-11-30 21:25:21.092647): 2018-11-28 21:25:21.025275 (2 days ago)
}
185
likes
0
points
23.4k
downloads

Publisher

verified publisherxantiagoma.com

Weekly Downloads

An inmutable date manipulation library. dart_date provides a comprehensive, simple and consistent toolset for manipulating and parsing Dart dates in pure Dart (to be used in Flutter/Mobile, Web, Server or CLI apps).

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

intl, timeago

More

Packages that depend on dart_date