I've come across a strange error for date output in Content Fragments for dates set during the last week of a year. For instance, the last week of 2021 was December 26 through 31. Dates set in a Content Fragment for these days in December are outputting the incorrect year 2022. If I select a date prior to the last week, the year is output correctly.
As shown on the page:
Date set in CRXDE:
Date set in the content fragment:
If I change the date to a date from the last week of 2020, the date output is changed to 2021. These screenshots show the same fields on the front end and in the content fragment when updated to December 27, 2020.
However, selecting December 26, 2020 shows the correct year as the last week of 2020 was December 27 - 31.
The only years that display the last week of the year correctly are those where the last day of the year is on a Saturday, such as 2016.
I have tested output of dates during the last week of the year in other components pulling from the page properties and have not seen this same issue. Is this a problem with the Content Fragment dates specifically? Do I need to submit something to the Core components issues? I've tried changing the output properties for timezone and locale with no change to the year.
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks for verifying.
I did some additional checks, and the as I suspected, the last week of the year is returning as week 1 which seems to be why it's advancing the year. I was able to add in some JavaScript to check for the month as December and week as 1 to modify the year on output for now but I will submit an issue to the Core GitHub.
Hi @jetate
I could reproduce your issue (tried in 6.5.0)
Additional observation is that if we access the CF programmatically to retrieve the date element value, it is coming correctly.
Perhaps you can raise a GitHub issue (Core components v1 content fragment)
Thanks for verifying.
I did some additional checks, and the as I suspected, the last week of the year is returning as week 1 which seems to be why it's advancing the year. I was able to add in some JavaScript to check for the month as December and week as 1 to modify the year on output for now but I will submit an issue to the Core GitHub.