Hacker News new | ask | show | jobs
by deathanatos 2168 days ago
Kind of, but not really? The proposal's Absolute represents time in the POSIX timescale, so it is inherently incapable of representing all of TAI, the same as it is inherently incapable of representing UTC.

I attempted to test your library's behavior in this regard, but I do not think you are correctly implementing the proposal's TimeZone. TimeZone.getDateTimeFor() is supposed to take an Absolute and return, in your case, the time that absolute represents in TAI (that time, in the TimeZone). But this:

  var one_before = new Temporal.Absolute(915148799n * 1000000000n);
  console.log(one_before.toString());
  console.log((new Temporal.TimeZone('UTC')).getDateTimeFor(one_before).toString());
  console.log((new TAI()).getDateTimeFor(one_before).toString());
emits,

  1998-12-31T23:59:59Z
  1998-12-31T23:59:59
  1970-01-01T00:15:15.148768
That last timestamp being the output supposedly in TAI; but that POSIX timestamp, 915148799 represents 1999-01-01T00:00:30 in TAI. That is, the second line, 1998-12-31T23:59:59 in UTC == 1999-01-01T00:00:30 TAI.

The other direction (getPossibleAbsolutes) is similarly effected.