After the update from Jiffy 5 to version 6.2.1, the fromNow() method is failing using a Jiffy.parse(createdAt).fromNow() - recommending using a pattern (Error message: "Could not read date time of input 2023-11-15T08:48:02.169584+00:00, try using a pattern, e.g. input: "12, Oct", pattern: "dd, MMM""
If I then add a pattern, like also suggested here: https://github.com/jama5262/jiffy/issues/227
Trying this:
Jiffy.parse(createdAt, pattern: 'yyyy-MM-ddThh:mm:ss', isUtc: true)
.fromNow();
Results in:
"Could not parse input 202311-15T08:48:02.169584+00:00, failed with the following error: FormatException: Trying to read - from 202311-15T08:48:02.169584+00:00 at 10"
the createdAt timestamp as input was: 2023-11-15T08:48:02.169584+00:00
Somehow during the internal _parse methods, the first "-" gets lost when using a pattern.
How to reproduce the bug
Try to use the fromNow() method with any Iso date string and the respective pattern
Find error
What is the expected behavior
Correct calculation of "fromNow" which also includes the timezone / UTC true/false
Screenshots
Step before with correct String in parser.dart:
Step afterwards with missing "-":
Step
If applicable, add screenshots to help explain your problem.
Additional information
Converting the String-date in a DateTime object and calculating the fromNow() from there works fine.
Describe the bug
After the update from Jiffy 5 to version 6.2.1, the fromNow() method is failing using a Jiffy.parse(createdAt).fromNow() - recommending using a pattern (Error message: "Could not read date time of input
2023-11-15T08:48:02.169584+00:00
, try using a pattern, e.g. input: "12, Oct", pattern: "dd, MMM""If I then add a pattern, like also suggested here: https://github.com/jama5262/jiffy/issues/227 Trying this: Jiffy.parse(createdAt, pattern: 'yyyy-MM-ddThh:mm:ss', isUtc: true) .fromNow();
Results in: "Could not parse input
202311-15T08:48:02.169584+00:00
, failed with the following error: FormatException: Trying to read - from 202311-15T08:48:02.169584+00:00 at 10"the createdAt timestamp as input was: 2023-11-15T08:48:02.169584+00:00 Somehow during the internal _parse methods, the first "-" gets lost when using a pattern.
How to reproduce the bug
What is the expected behavior
Correct calculation of "fromNow" which also includes the timezone / UTC true/false
Screenshots Step before with correct String in parser.dart:
Step afterwards with missing "-":
Step If applicable, add screenshots to help explain your problem.
Additional information
Converting the String-date in a DateTime object and calculating the fromNow() from there works fine.