This change uses the Temporal API, which is a proposed new date handling extension for JavaScript. As browsers don't yet support it, it has been added via the @js-temporal/polyfill library.
During processing, each program item has a dateAndTime field populated with is a Temporal.zonedDateTime field in the convention timezone. When displaying the output, can use the withTimeZone method to convert to the browser timezone, which cuts down the complexity of the code considerably.
It also converts the local and convention zonedDateTime values to PlainDate values. Comparing these lets us check if the item is on the previous or next day, and add a label accordingly.
I haven't looked at the code that checks if convention is currently ongoing, but I think this could also be considerably simplified.
This change uses the Temporal API, which is a proposed new date handling extension for JavaScript. As browsers don't yet support it, it has been added via the
@js-temporal/polyfill
library.During processing, each program item has a
dateAndTime
field populated with is aTemporal.zonedDateTime
field in the convention timezone. When displaying the output, can use thewithTimeZone
method to convert to the browser timezone, which cuts down the complexity of the code considerably.It also converts the local and convention zonedDateTime values to PlainDate values. Comparing these lets us check if the item is on the previous or next day, and add a label accordingly.
I haven't looked at the code that checks if convention is currently ongoing, but I think this could also be considerably simplified.