Skip to content

Commit

Permalink
fix(ui5-datetime-picker): change dateformat to datetime instance (#9024)
Browse files Browse the repository at this point in the history
The DateTimePicker was calling an inherited getFormat method, which was creating an instance with getDateInstance method.
Now we are using the correct format created with getDateTimeInstance method.
  • Loading branch information
tsanislavgatev authored May 21, 2024
1 parent 49abb03 commit e5051ea
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/main/src/DateTimePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CalendarDate from "@ui5/webcomponents-localization/dist/dates/CalendarDat
import type { IFormInputElement } from "@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js";
import "@ui5/webcomponents-icons/dist/date-time.js";
import UI5Date from "@ui5/webcomponents-localization/dist/dates/UI5Date.js";
import DateFormat from "@ui5/webcomponents-localization/dist/DateFormat.js";
import Button from "./Button.js";
import type ResponsivePopover from "./ResponsivePopover.js";
import ToggleButton from "./ToggleButton.js";
Expand Down Expand Up @@ -396,6 +397,20 @@ class DateTimePicker extends DatePicker implements IFormInputElement {
return selectedDate;
}

getFormat() {
return this._isPattern
? DateFormat.getDateTimeInstance({
strictParsing: true,
pattern: this._formatPattern,
calendarType: this._primaryCalendarType,
})
: DateFormat.getDateTimeInstance({
strictParsing: true,
style: this._formatPattern,
calendarType: this._primaryCalendarType,
});
}

/**
* @override
*/
Expand Down

0 comments on commit e5051ea

Please sign in to comment.