Skip to content

Commit

Permalink
renamed local timezone method
Browse files Browse the repository at this point in the history
  • Loading branch information
Gengar-i committed May 22, 2023
1 parent 5298b9a commit 53679c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/js/scripts/admin.picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const SELECTOR_PICKER_INPUT = '.ibexa-date-time-picker__input';
const SELECTOR_FORM_INPUT = '.ibexa-picker__form-input';
const pickers = doc.querySelectorAll(SELECTOR_PICKER);
const { formatShortDateTime, convertDateToTimezone, browserTimezone } = ibexa.helpers.timezone;
const { formatShortDateTime, convertDateToTimezone, getBrowserTimezone } = ibexa.helpers.timezone;
const userTimezone = ibexa.adminUiConfig.timezone;
const pickerConfig = {
enableTime: true,
Expand All @@ -26,7 +26,7 @@
if (formInput.value) {
const date = new Date(formInput.value * 1000);
const dateWithUserTimezone = convertDateToTimezone(date, userTimezone);
const localTimezone = browserTimezone();
const localTimezone = getBrowserTimezone();
const convertedDate = convertDateToTimezone(dateWithUserTimezone, localTimezone, true).format();

defaultDate = convertedDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
const formatShortDateTime = (date, timezone = userPreferredTimezone, format = userPreferredShortDateTimeFormat) => {
return formatDate(date, timezone, format);
};
const browserTimezone = () => {
const getBrowserTimezone = () => {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
};

ibexa.addConfig('helpers.timezone', {
convertDateToTimezone,
formatFullDateTime,
formatShortDateTime,
browserTimezone,
getBrowserTimezone,
});
})(window, window.document, window.ibexa, window.moment);

0 comments on commit 53679c6

Please sign in to comment.