All Projects → jama5262 → Jiffy

jama5262 / Jiffy

Licence: mit
Jiffy is a Flutter (Android, IOS and Web) date time package inspired by momentjs for parsing, manipulating, querying and formatting dates

Programming Languages

dart
5743 projects
dartlang
94 projects

Projects that are alternatives of or similar to Jiffy

Date Picker
📅 Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (-38.66%)
Mutual labels:  time, date, datetime
Gostradamus
Gostradamus: Better DateTimes for Go 🕰️
Stars: ✭ 148 (-37.82%)
Mutual labels:  time, date, datetime
Iso8601
Ruby parser to work with ISO8601 dateTimes and durations — http://en.wikipedia.org/wiki/ISO_8601
Stars: ✭ 70 (-70.59%)
Mutual labels:  time, date, datetime
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+347.9%)
Mutual labels:  time, date, datetime
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (-21.43%)
Mutual labels:  time, date, datetime
When
A natural language date/time parser with pluggable rules
Stars: ✭ 1,113 (+367.65%)
Mutual labels:  time, date, datetime
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+733.19%)
Mutual labels:  time, date, datetime
Dayjs
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
Stars: ✭ 37,373 (+15602.94%)
Mutual labels:  time, date, datetime
Dateparse
GoLang Parse many date strings without knowing format in advance.
Stars: ✭ 1,365 (+473.53%)
Mutual labels:  time, date, datetime
Luatz
Time, Date and Timezone library for lua
Stars: ✭ 92 (-61.34%)
Mutual labels:  time, date, datetime
Tail.datetime
A lightweight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!
Stars: ✭ 139 (-41.6%)
Mutual labels:  time, date, datetime
Calendar
📅 PHP Date & Time library that solves common problems in object oriented, immutable way.
Stars: ✭ 113 (-52.52%)
Mutual labels:  time, date, datetime
Zulu
A drop-in replacement for native Python datetimes that embraces UTC.
Stars: ✭ 52 (-78.15%)
Mutual labels:  time, date, datetime
Delorean
Delorean: Time Travel Made Easy
Stars: ✭ 1,793 (+653.36%)
Mutual labels:  time, date, datetime
Tinydate
A tiny (349B) reusable date formatter. Extremely fast!
Stars: ✭ 990 (+315.97%)
Mutual labels:  time, date, datetime
Carbon
A simple PHP API extension for DateTime
Stars: ✭ 75 (-68.49%)
Mutual labels:  time, date, datetime
Period
PHP's time range API
Stars: ✭ 616 (+158.82%)
Mutual labels:  time, date, datetime
Vue Datetime
Mobile friendly datetime picker for Vue. Supports date and datetime modes, i18n and more.
Stars: ✭ 928 (+289.92%)
Mutual labels:  time, date, datetime
Graphql Java Datetime
GraphQL ISO Date is a set of RFC 3339 compliant date/time scalar types to be used with graphql-java.
Stars: ✭ 89 (-62.61%)
Mutual labels:  time, date, datetime
Time Stamp
Get a formatted timestamp. Used in gulp, assemble, generate, and many others.
Stars: ✭ 104 (-56.3%)
Mutual labels:  time, date, datetime

Jiffy

Build Status Coverage Status License: MIT Pub Version Platform

Jiffy is a Flutter (Android, IOS and Web) date time package inspired by momentjs for parsing, manipulating, querying and formatting dates

Full Documentation | Installation | ChangeLog | Examples

Usage

Format Dates

Jiffy([2021, 1, 19]).format("MMMM do yyyy, h:mm:ss a"); // January 1st 2021, 12:00:00 AM
Jiffy().format("EEEE"); // Tuesday
Jiffy().format("MMM do yy"); // Mar 2nd 21
Jiffy().format("yyyy [escaped] yyyy"); // 2021 escaped 2021
Jiffy().format(); // 2021-03-02T15:18:29.922343

Jiffy([2020, 10, 19]).yMMMMd; // January 19, 2021

Jiffy({
  "year": 2020,
  "month": 10,
  "day": 19,
  "hour": 19
}).yMMMMEEEEdjm; // Monday, October 19, 2020 7:14 PM

//  You can also use default formats
Jiffy("19, Jan 2021", "dd, MMM yyyy").yMMMMd; // January 19, 2021

Jiffy().yMMMMEEEEdjm; // Tuesday, March 2, 2021 3:20 PM

Relative Time

Jiffy("2011-10-31", "yyyy-MM-dd").fromNow(); // 9 years ago

var jiffy1 = Jiffy()
    ..startOf(Units.DAY);
jiffy1.fromNow(); // 19 hours ago

var jiffy2 = (Jiffy()..endOf(Units.DAY)).fromNow(); // in 5 hours

var jiffy3 = (
    Jiffy()
    ..startOf(Units.HOUR)
    ..add(hours: 2, minutes: 20)
).fromNow(); // in 2 hours

Manipulation

var jiffy1 = Jiffy()..add(duration: Duration(days: 1));
jiffy1.yMMMMd; // March 3, 2021

var jiffy2 = (Jiffy()..subtract(days: 1)).yMMMMd; // March 1, 2021

//  You can chain methods by using Dart method cascading
var jiffy3 = (
    Jiffy()
     ..add(hours: 3, days: 1)
     ..subtract(minutes: 30, months: 1)
);
jiffy3.yMMMMEEEEdjm; // Wednesday, February 3, 2021 6:07 PM

// 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

Locale Support

//  The locale method always return a future
//  To get locale (The default locale is English)
await (Jiffy.locale()).code; // en

//  To set locale
await Jiffy.locale("fr");
Jiffy().yMMMMEEEEdjm; // samedi 19 octobre 2019 19:25

await Jiffy.locale("ar");
Jiffy().yMMMMEEEEdjm; // السبت، ١٩ أكتوبر ٢٠١٩ ٧:٢٧ م

await Jiffy.locale("zh_cn");
Jiffy().yMMMMEEEEdjm; // 2019年10月19日星期六 下午7:28

Contributing

To contribute, follow the following easy steps

Step 1
  • Fork this repo!
Step 2
  • Make your own updates
Step 3
  • Create a new pull request

Support

Reach out to me at one of the following places!

License

MIT License

Copyright (c) 2019 Jama Mohamed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].