hannonhill / exchange-resources

New repo for cleaned up Exchange Sites for Cascade CMS.
https://www.hannonhill.com/resources/exchange/index.html
6 stars 11 forks source link

Calendar - Events XML dates are formatted using Week Year instead of Year causing events in the first and last weeks of the year to have incorrect dates #7

Open megoconnor opened 4 years ago

megoconnor commented 4 years ago

Description

The events-xml Format that drives the main calendar uses YYYY which is a "Week Year" in Java to format dates:

A week year is in sync with a WEEK_OF_YEAR cycle. All weeks between the first and last weeks (inclusive) have the same week year value. Therefore, the first and last days of a week year may have different calendar year values.

This can cause events in the first and last weeks of the year to have incorrect dates. (Thanks to @LadySnowy for spotting this one.)

Workaround

Edit the _cms/formats/outputs/xml/events-xml Format and change any reference to YYYY when formatting dates to yyyy. Example:

Before:

#set($startISO  = $_DateTool.format("YYYY-MM-dd", $_DateTool.getDate($starts))

After:

#set($startISO  = $_DateTool.format("yyyy-MM-dd", $_DateTool.getDate($starts))
megoconnor commented 4 years ago

gz#12657