00:12
<Michael Ficarra>
is there any way to represent an "anywhere on earth" (AoE) time in Temporal, or am I just expected to know what the timezone with the biggest negative offset is at all times?
00:18
<ptomato>
it would be up to the TZDB to add such a time zone, I guess. if there was a mechanism to find the time zone with the biggest negative offset, it would not work on hosts that ship no TZDB. it would also leak fingerprinting information without obviously doing so
00:18
<Michael Ficarra>
I guess both "everywhere on earth" (highest magnitude negative offset) and "somewhere on earth" (highest magnitude positive offset) are useful, though I have only seen a use for the former
00:19
<Michael Ficarra>
ptomato: it's not a unique timezone, but it could be an alias I guess?
00:31
<ptomato>

here's an off-the-cuff code snippet that will give you the last possible local time when it is still 2023-04-20 anywhere on earth:

const aoeWallTime = Temporal.PlainDateTime.from('2023-04-20T23:59:59.999999999');
const aoeExactTime = Intl.supportedValuesOf('timeZone').reduce((last, id) => {
  const candidate = aoeWallTime.toZonedDateTime(id);
  if (!last || Temporal.ZonedDateTime.compare(candidate, last) > 0) return candidate;
  return last;
}, null);
const localTime = aoeExactTime.withTimeZone(Temporal.Now.timeZoneId());
console.log(localTime.toString());
00:39
<Michael Ficarra>
eh, that works well enough for me
00:42
<Michael Ficarra>
might still be nice to be able to actually represent that time in a way that you can pass around to other APIs or store for later
00:45
<ptomato>
what you store for later depends on whether you want the stored time to change if the host updates its TZDB
00:45
<Michael Ficarra>
I do
00:46
<ptomato>
if you don't, storing aoeExactTime.toInstant() is enough. if you do, you have to store aoeWallTime and run this snippet again
00:47
<Michael Ficarra>
yes, exactly, that's the thing I am asking for
00:47
<Michael Ficarra>
it sounds like it will require a timezone alias be added to tzdb
00:48
<ptomato>
I mean ... this could be a TC39 thing - but that seems like the wrong domain to solve the problem in
11:49
<ryzokuken>
Could this be achieved through custom timezones?
11:50
<ryzokuken>
Although I guess all the rest of Temporal would need to know how to handle that... We do need an Etc/AoE or something of the sort