I want to compare ISO 8601 dates in javascript as strings instead of making Date objects for each string and comparing objects.
var date_array = [\'2012-10-01\
Using that comparison operator will look at the strings values lexicographically, which means the dictionary order.
In ASCII, the decimal digits are sequentially stored smallest (0
, 0x30
) to largest (9
, 0x39
). If they're consistently in this format, largest value (year) to smallest (day) and always 0
padded to the largest possible value, then these comparisons will be fine.