Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Content Fragment Date for Last Week of a Year

Avatar

Level 4

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:

jetate_0-1641228409961.png

Date set in CRXDE:

jetate_1-1641228427191.png


Date set in the content fragment:

jetate_2-1641228485216.png

 

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. 

jetate_3-1641228571927.pngjetate_4-1641228589312.png

 

However, selecting December 26, 2020 shows the correct year as the last week of 2020 was December 27 - 31.

jetate_5-1641228673749.pngjetate_6-1641228690212.png


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.

jetate_7-1641228841125.pngjetate_8-1641228852445.png

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. 

 

1 Accepted Solution

Avatar

Correct answer by
Level 1

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.

View solution in original post

2 Replies

Avatar

Community Advisor

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)

 

Avatar

Correct answer by
Level 1

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.