jama5262 / jiffy

Jiffy is a Flutter (Android, IOS and Web) date time package for parsing, manipulating, querying and formatting dates
https://pub.dev/packages/jiffy
MIT License
588 stars 126 forks source link

Timestampz not working anymore after upgrade 5.0 -> 6.1 #227

Closed jstdk closed 1 year ago

jstdk commented 1 year ago

Is your feature request related to a problem? Please describe. This worked fine in version 5:

Jiffy(timestampz_variable).fromNow()

Whatever I try (tried many things from the docs), I can't get passed this error:

Another exception was thrown: JiffyException: Could not read date time of input 2023-04-21T07:51:06.43279+00:00, try using a pattern, e.g. input: "12, Oct", pattern: "dd, MMM"

I need to convert the below pattern to Jiffy, but Jiffy docs only mention yyyy-MM-dd 2023-04-21T07:51:06.43279+00:00 I made it this far:

Jiffy.parse(timestampz, pattern:'yyyy-MM-dd <WHAT TO PUT HERE>').fromNow()

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] It is unclear how to do this in version 6. The DateTime/Timestamp examples in the documentation do not work (Jiffy Exception)

Describe the solution you'd like

Documentation on timestampz usage or complex patterns

Describe alternatives you've considered

All options from 'Time from now' section in documentation + trying to create patterns

jstdk commented 1 year ago

Found the answer after playing around:

Jiffy.parse(timestampz_variable,pattern:'yyyy-MM-ddThh:mm:ss',isUtc:true).fromNow()