Closed TrevorBurnham closed 11 years ago
hmm this gets tricky since a string parameter can be both with a time string and a timezone string. That's why we use the '/'.
How about interpreting the string as a timezone if Date.parse(str) returns NaN
? There are a few valid timezones that some browsers will generously interpret as dates (specifically, those of the form GMT+n
or Etc/GMT+n
), but those aren't actually valid dates in ISO 8601, so it's OK to strip them.
So instead of
TZ_REGEXP.test(args[args.length - 1])
I'm suggesting
isNaN(Date.parse(args[args.length - 1].replace(/GMT\+\d+/, '')))
Hmm yeah that should work. Care to pull request? :)
Because
TZ_REGEXP
requires a/
to match, a call likedoes not interpret the second argument as a timezone, even if the
backward
zone file has been loaded.