Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in fromNow() method using String as input #255

Open
MaxSchilling opened this issue Nov 22, 2023 · 2 comments
Open

Error in fromNow() method using String as input #255

MaxSchilling opened this issue Nov 22, 2023 · 2 comments

Comments

@MaxSchilling
Copy link

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: #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

  1. Try to use the fromNow() method with any Iso date string and the respective pattern
  2. 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:
image

Step afterwards with missing "-":
image

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.

@debjeetproso
Copy link

Have you found any solution for this ?

@jama5262
Copy link
Owner

jama5262 commented May 12, 2024

@MaxSchilling I was not able to reproduce the issue, in v6.2.1, can you try again, but using Jiffy v6.3.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants