Closed dcastro closed 1 year ago
When there is no DateReference, TimeReference (TimeOfDay 10 0 0) Nothing Nothing should be interpreted as "10:00 in the current day in the given timezone". If it's already past 10:00 in the given timezone, it should be interpreted as "10:00 the next day in the given timezone".
Often when there is no DateReference, we can't know it for sure what day is meant, so in the ephemeral messages we shouldn't mention the concrete day, I think. But still, we need to recalculate the time, and we need to use some day for this, in this case using this/next day for recalculating implicitly is OK, I think. But we need to distinguish between the day clearly specified by the sender and the day assumed implicitly.
Clarification and motivation
Implement the
timeReferenceToUTC
function.Given a
TimeReference
(see #1 for examples), we want to convert it to a moment in time expressed in UTC.For example, if:
The result of
timeReferenceToUTC
should be 2022-05-01 23:00 UTC.When there is no
LocationReference
(as in the example above), we should assume the time reference is relative to the sender's timezone.When there is no
DateReference
,TimeReference (TimeOfDay 10 0 0) Nothing Nothing
should be interpreted as "10:00 in the current day in the given timezone". If it's already past 10:00 in the given timezone, it should be interpreted as "10:00 the next day in the given timezone".When
DateReference
isDaysFromToday n
, we should interpret that asn
days from the current date in the given timezone.When
DateReference
is a day of the week, e.g.Tuesday
, it should be interpreted as the next tuesday (or today, if today is tuesday in the given timezone).Be aware that:
timeReferenceToUTC
should returnTRTUAmbiguous
TRTUInvalid
TRTUInvalidTimeZoneAbbrev
.Acceptance criteria
timeReferenceToUTC
is capable of transforming time references into UTC datetimes.