diff --git a/README.md b/README.md index b6bcd5c..ac0aca6 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ [![Pub Version](https://img.shields.io/badge/pub-v2.1.2-blue)](https://pub.dev/packages/jiffy) [![Platform](https://img.shields.io/badge/platform-flutter%7Cweb%7Cdart%20vm-orange)](https://github.com/jama5262/jiffy) -Jiffy is a dart date time package inspired by [momentjs](https://momentjs.com/) for parsing, manipulating, querying and formatting dates +Jiffy is a Flutter (Android, IOS and Web) date time package inspired by [momentjs](https://momentjs.com/) for parsing, manipulating, querying and formatting dates -#### [Full Documentation](https://github.com/jama5262/jiffy/tree/v2.1.2/doc) | [Installation](https://pub.dev/packages/jiffy#-installing-tab-) | [ChangeLog](https://pub.dev/packages/jiffy#-changelog-tab-) | [Examples](https://pub.dev/packages/jiffy#-example-tab-) +### [Full Documentation](https://github.com/jama5262/jiffy/tree/v2.1.2/doc) | [Installation](https://pub.dev/packages/jiffy#-installing-tab-) | [ChangeLog](https://pub.dev/packages/jiffy#-changelog-tab-) | [Examples](https://pub.dev/packages/jiffy#-example-tab-) # Usage @@ -74,8 +74,9 @@ var jiffy4 = Jiffy() jiffy4.format("dd/MM/yyy"); // 20/10/2019 -// Months and year are added in respect to how many days there are in a months and if is a year is a leap year -Jiffy("2010-1-31", "yyyy-MM-dd"); // This is January 31 +// Months and year are added in respect to how many +// days there are in a months and if is a year is a leap year +Jiffy("2010/1/31", "yyyy-MM-dd"); // This is January 31 Jiffy([2010, 1, 31]).add(months: 1); // This is February 28 ``` diff --git a/doc/README.md b/doc/README.md index 7675dee..3b6e279 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,7 +6,7 @@ [![Pub Version](https://img.shields.io/badge/pub-v2.1.2-blue)](https://pub.dev/packages/jiffy) [![Platform](https://img.shields.io/badge/platform-flutter%7Cweb%7Cdart%20vm-orange)](https://github.com/jama5262/jiffy) -Jiffy is a dart date time package inspired by [momentjs](https://momentjs.com/) for parsing, manipulating, querying and formatting dates +Jiffy is a Flutter (Android, IOS and Web) date time package inspired by [momentjs](https://momentjs.com/) for parsing, manipulating, querying and formatting dates # Table of content - [Before Use](#before-use) @@ -67,10 +67,9 @@ Jiffy().utc(); // Returns a DateTime instance _**But when doing a method chaining, it is recommended to use a variable.**_ The variable will then hold a Jiffy instance. Example ```dart var jiffy = Jiffy() - ..utc() ..add(days: 1) - ..add(hours: 3) ..subtract(minutes: 30); // Returns a Jiffy instance + ..utc() ``` Now `jiffy` variable returns a Jiffy instance. To get the date time, you can call it with the following methods ```dart @@ -93,10 +92,15 @@ Jiffy().format(); // Return a ISO 8601 date time format ### String Creating a Jiffy from a string. See below ```dart -Jiffy("1995-12-25"); +Jiffy("1995-12-25"); // A calendar date part +Jiffy("1995/12/25"); // A calendar date part separated by slash "/" +Jiffy("19951225"); // Basic (short) full date +Jiffy("1995-12-25 12:00:00.000"); // An hour, minute, second, and millisecond time part +Jiffy("1995-12-25T12:00:00.000"); ISO dart format +Jiffy("1995-12-25T12:00:00.000Z"); ISO dart format (UTC) ``` -**_Note: For now, Jiffy supports only `yyyy-MM-dd` string formats. Passing string like `dd-MM-yyyy` will result in an exception. If you do need to pass this format, `dd-MM-yyyy` or any other, should also pass a pattern of that string, Also know as [String Formating](#string-formatting). See below_** +**_Note: For now, Jiffy supports only the above string formats. Passing string like `dd-MM-yyyy` will result in an exception. If you do need to pass this format, `dd-MM-yyyy` or any other, should also pass a pattern of that string, Also know as [String Formating](#string-formatting). See below_** ```dart Jiffy("25-12-1995", "dd-MM-yyyy"); Jiffy("12-1995", "MM-yyyy"); @@ -116,7 +120,7 @@ Jiffy("0ct 19th", "MMM do"); Jiffy("19th October 2019", "do MMMM yyyy"); ``` -Jiffy runs on top of the [Intl DateFormat](https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html) package, you can find all the date time patterns used by Jiffy [here](https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html) +**_Note: Jiffy runs on top of the [Intl DateFormat](https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html) package, you can find all the date time patterns used by Jiffy [here](https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html)_** This is also same for Jiffy default formats. See below ```dart diff --git a/example/jiffy_example.dart b/example/jiffy_example.dart index 2ca5160..19a8b2b 100644 --- a/example/jiffy_example.dart +++ b/example/jiffy_example.dart @@ -20,11 +20,9 @@ main() async { }).yMMMMEEEEdjm; // Saturday, October 19, 2019 7:00 PM // RELATIVE TIME - Jiffy("20111001").fromNow(); // 8 years ago + Jiffy("2011-10-31").fromNow(); // 8 years ago Jiffy(DateTime(2012, 6, 20)).fromNow(); // 7 years ago - print(Jiffy(Jiffy("2020-01-01T11Z").format()).yMMMMdjm); - var jiffy1 = Jiffy() ..startOf("day"); jiffy1.fromNow(); // 19 hours ago