Browse Source

Fix 24-hour time format

master
Eduard Kuzmenko 4 years ago
parent
commit
b596502fa9
  1. 2
      src/helpers/date.ts
  2. 4
      src/lib/langPack.ts

2
src/helpers/date.ts

@ -65,6 +65,8 @@ export function formatDateAccordingToTodayNew(time: Date) {
}).element; }).element;
} }
MOUNT_CLASS_TO && (MOUNT_CLASS_TO.formatDateAccordingToTodayNew = formatDateAccordingToTodayNew);
export const getFullDate = (date: Date, options: Partial<{ export const getFullDate = (date: Date, options: Partial<{
noTime: true, noTime: true,
noSeconds: true, noSeconds: true,

4
src/lib/langPack.ts

@ -352,7 +352,9 @@ namespace I18n {
safeAssign(this, options); safeAssign(this, options);
//var options = { month: 'long', day: 'numeric' }; //var options = { month: 'long', day: 'numeric' };
const dateTimeFormat = new Intl.DateTimeFormat(lastRequestedLangCode, this.options);
// * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle#adding_an_hour_cycle_via_the_locale_string
const dateTimeFormat = new Intl.DateTimeFormat(lastRequestedLangCode + '-u-hc-h23', this.options);
(this.element as any)[this.property] = capitalizeFirstLetter(dateTimeFormat.format(this.date)); (this.element as any)[this.property] = capitalizeFirstLetter(dateTimeFormat.format(this.date));
} }

Loading…
Cancel
Save