ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[Calendar - Day Picker]: Week numbers are incorrectly calculated

Open allen138 opened this issue 2 years ago • 1 comments

Bug Description

Hi team,

This is an edge case, but when the config's calendarType is set to Islamic or Buddhist, and the date picker/calendar component has primary-calendar-type set to Gregorian, the week numbers that are displayed are wrong. Please see: image

This is because in the calculation it will get the oJanFirst from a new UniversalDate object, but this object will be an instance of the config calendar, so when it does the calculation on line 27, the result is way off. calculateWeekNumber.ts#L19

(Note: This is not reproducible on openUI5, so I presume they have different logic to calculate the week number.)

Affected Component

Day Picker

Expected Behaviour

They week number will be the correct value per that calendar type being used for the component. (Note, week numbers are only used for Gregorian calendar)

Isolated Example

https://codesandbox.io/s/ui5-webcomponents-forked-4pphi9?file=/index.html

Steps to Reproduce

Please see the Isolated example. Open the date picker and see the week numbers are displayed incorrectly.

Log Output, Stack Trace or Screenshots

No response

Priority

Medium

UI5 Web Components Version

main

Browser

Chrome, Edge, Firefox, Safari

Operating System

All

Additional Context

No response

Declaration

  • [X] I’m not disclosing any internal or sensitive information.

allen138 avatar Mar 30 '23 20:03 allen138

Hello @SAP/ui5-webcomponents-topic-b,

The issue is reproducible on the main branch. Could you please check this?

Best regards, Stefan

Lyserg-Diethel avatar Mar 31 '23 11:03 Lyserg-Diethel