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

Issue with year parsing #41

Open
jamesrweb opened this issue Jul 17, 2024 · 0 comments
Open

Issue with year parsing #41

jamesrweb opened this issue Jul 17, 2024 · 0 comments

Comments

@jamesrweb
Copy link

This timestamp can be parsed correctly as shown here:

Screenshot 2024-07-17 at 18 50 39

In my application, the createdAt value is sent in via JS, parsed correcly via Json.Decode.int and converted to a Posix correctly via millisToPosix as shown here:

Screenshot 2024-07-17 at 18 53 45

However, when using the formatter with the following configuration:

...
 Html.text <| formatPosixToString Time.utc <| User.createdAt user
...

formatPosixToString : Time.Zone -> Time.Posix -> String
formatPosixToString =
    DateFormat.format
        [ DateFormat.monthNameFull
        , DateFormat.text " "
        , DateFormat.dayOfMonthSuffix
        , DateFormat.text ", "
        , DateFormat.yearNumber
        , DateFormat.text " at "
        , DateFormat.hourFixed
        , DateFormat.text ":"
        , DateFormat.minuteFixed
        , DateFormat.text ":"
        , DateFormat.secondFixed
        , DateFormat.text " "
        , DateFormat.amPmUppercase
        ]

It shows the following:

Screenshot 2024-07-17 at 18 55 28

Quite confusing... any ideas?

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

1 participant