Is direct comparison of Javascript ISO Date Strings safe?
问题 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? 回答1: 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