When the configuration sets Buddhist as the calendarType and the user tries to select an old date either manually or through the calendar picker onChange will cause the year to increment by 2. The incrementation only happens when month is April or Greater and when the Buddhist year is 2484 or less (Gregorian year 1941 or less). This is because before January 1, 1941, the Thai calendar first of the year was actually April 1st. (which is what is explained here, sap/ui/core/date/Buddhist.js#L14-L24. The reason for the incrementation is because every time the date-string is parsed/formatted the value of the year will increment by 1. For the date picker, the parse/formatting will happen during DatePicker.ts#L533?_updateValueAndFireEvents() and DatePicker.ts#L425?onBeforeRendering()
In my opinion, the logic in the date picker/calendar components are correct and the root cause likely lies within src/sap/ui/core/date/Buddhist.js#L82-L85, but the behavior between openUI5 sap.m.DatePicker and the webcomponent is different. Hence, this GH issue.
OpenUI5, only increments by 1 whereas ui5-wc increments by 2.
Open date picker, select a date. OpenUI5 does not increment whereas ui5-wc increments by 2.
For now we can focus on the behavior of the webcomponent.
Affected Component
Date Picker/Calendar Components
Expected Behaviour
Using the Buddhist Thai calendar, the user is able to manually enter a date or select a date through the picker without it being modified under the covers.
Bug Description
Hi team,
When the configuration sets Buddhist as the calendarType and the user tries to select an old date either manually or through the calendar picker
onChange
will cause the year to increment by 2. The incrementation only happens when month is April or Greater and when the Buddhist year is 2484 or less (Gregorian year 1941 or less). This is because before January 1, 1941, the Thai calendar first of the year was actually April 1st. (which is what is explained here, sap/ui/core/date/Buddhist.js#L14-L24. The reason for the incrementation is because every time the date-string is parsed/formatted the value of the year will increment by 1. For the date picker, the parse/formatting will happen during DatePicker.ts#L533?_updateValueAndFireEvents() and DatePicker.ts#L425?onBeforeRendering()In my opinion, the logic in the date picker/calendar components are correct and the root cause likely lies within src/sap/ui/core/date/Buddhist.js#L82-L85, but the behavior between openUI5 sap.m.DatePicker and the webcomponent is different. Hence, this GH issue.
OpenUI5, only increments by 1 whereas ui5-wc increments by 2.
Open date picker, select a date. OpenUI5 does not increment whereas ui5-wc increments by 2.
For now we can focus on the behavior of the webcomponent.
Affected Component
Date Picker/Calendar Components
Expected Behaviour
Using the Buddhist Thai calendar, the user is able to manually enter a date or select a date through the picker without it being modified under the covers.
Isolated Example
https://codesandbox.io/s/ui5-webcomponents-forked-gm7tuh?file=/index.html
Steps to Reproduce
Log Output, Stack Trace or Screenshots
No response
Priority
None
UI5 Web Components Version
main
Browser
Chrome, Edge, Firefox, Safari
Operating System
No response
Additional Context
No response
Declaration