Is it safe to directly compare ISO Date Strings like this:
"2018-03-16T18:00:00.000z" > "2018-04-16T18:00:00.000z" // false
It seems as long as leading zeros are used (proper ISO formatting) this comparison is safe and there is no need to convert the values to Date Objects. Am I overlooking something?
With the given format of a ISO 8601 time,
2018-03-16T18:00:00.000Z
^
you could use a direct string comparison, because the given time zone is a
Coordinated Universal Time (UTC)
If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With