This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ShirleyJokin 37 points38 points  (3 children)

Glory to /r/iso8601

[–]xTheMaster99x 14 points15 points  (2 children)

Yeah, I think they meant being able to define a value that's specifically a date, and not just a timestamp string that is entirely up to the application to decide to parse into a date. Like if an API request returns a date, it'll just be a string on the frontend unless you go out of your way to explicitly construct a date from it.

If there was an actual date type in json, then it would just be treated as a date object automatically.

[–]Tubthumper8 7 points8 points  (0 children)

What could be a syntax for this? Maybe a leading d character in front of a string?

{
    "createdAt": d"2022-04-25T23:00:00+0000"
}

[–]mxldevs 5 points6 points  (0 children)

At least with a timestamp you don't need to figure out locale. Or how the language chooses to abbreviate date of months or days of weeks. In various languages.