[Extended DateTime] Leap year week numbers do not match.

Forge Component
Published on 2019-08-08 by Caio Santana Magalhães
7 votes
Published on 2019-08-08 by Caio Santana Magalhães

We struggled with the leap years a lot. So its the first thing i looked at within this plugin. I'm sad to say that for as far i can tell, the leap year 2024 gives back 53 weeks. in reality the year 2024 has 52 weeks and the 30 and 31st of December are part of the 1st week of 2025.

Are you guys aware of that and working on it? 

Hi Marc,

This component uses the standard Calendar class from the .NET framework, specifically the Calendar.GetWeekOfYear function.

I think the result you are after can be obtained by using WeekRule 1 (full week) and FirstDayOfWeek 0 (Sunday). Here's a test from the demo.


Be advised, though, that when using WeekRule 1 (full week), the range between Jan 1st 2025 and Jan 4th 2025 still returns 52 since it's still part of the last week from the previous year.