@Musaran said:
getFullYear() returns... the full year ? Not quite : on 4 digits, because y10k bug quota is not met yet.
No. That would be a browser limitation. For instance:
new Date(36e4 + Date.parse("9999-12-31T23:59")
will present itself as being on "Sat Jan 01 10000" in Firefox. The getFullYear
method will also correctly return the integer value 10000. However you should not try to use Date.parse
on the string representation "+10000-01-01" just yet, because that will still return NaN
.
(Extension into years of 5 or more digits is an optional part of ISO 8601 and Firefox does not support it when parsing dates. Or atleast; not yet.)
@Musaran said:
The UTC equivalent of parse() is... parseUTC() ? Try again : UTC().
And this is also not correct. The signature is Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
and you use it together with the regular Date constructor to specify a component-wise date time in UTC instead of the local timezone. E.g.
// Start of December 31 2012 in UTC
new Date(Date.UTC(2012,12,31))
// Start of December 31 2012 in the local timezone
new Date(2012,12,31)
(I still agree with you that JavaScript's Date is WTF worthy, though...)