Closed floa93 closed 2 months ago
Hello @SAP/ui5-webcomponents-topic-b,
It seems value="20240528"
is not recognized as valid date in our code.
Is this expected behavior ?
Also, the issue is reproducible in the main branch.
Regards, Plamen Ivanov
Bug Description
If a ui5-special-date is given with a value(e.g.
value="20240528"
) in the format-pattern of the parent ui5-calendar(e.g.format-pattern="yyyyMMdd"
) an javascript error occurs and the calendar doesn't render.This calendar typescript code uses the Javascript date function https://github.com/SAP/ui5-webcomponents/blob/648717aabe3e9e1570ea54100edd5e922cd1b651/packages/main/src/Calendar.ts#L345 , which does not respect the format-pattern like done in https://github.com/SAP/ui5-webcomponents/blob/648717aabe3e9e1570ea54100edd5e922cd1b651/packages/main/src/Calendar.ts#L325 to check if this is a valid special date.
Affected Component
ui5-special-date
Expected Behaviour
The calendar special date should be usable with the custom format-pattern given
Isolated Example
No response
Steps to Reproduce
Workaround: use a valid new date() format like yyyy-MM-dd
CalendarDate.js:143 Uncaught (in promise) Error: Date parameter must be a JavaScript Date object: [Invalid Date]. at CalendarDate.fromLocalJSDate (CalendarDate.js:143:1) at Calendar.js:186:46 at Array.forEach ()
at get _specialCalendarDates (Calendar.js:181:1)
at Calendar.block0 (CalendarTemplate.lit.js:3:3983)
at executeTemplate (executeTemplate.js:12:1)
at Calendar.render (UI5Element.js:104:31)
at updateShadowRoot (updateShadowRoot.js:20:1)
at Calendar._render (UI5Element.js:580:29)
at renderImmediately (Render.js:31:1)