source: trip-planner-front/node_modules/@angular/common/esm2015/src/i18n/format_date.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 98.1 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { FormatWidth, FormStyle, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleId, getLocaleMonthNames, getLocaleNumberSymbol, getLocaleTimeFormat, NumberSymbol, TranslationWidth } from './locale_data_api';
9export const ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
10// 1 2 3 4 5 6 7 8 9 10 11
11const NAMED_FORMATS = {};
12const DATE_FORMATS_SPLIT = /((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
13var ZoneWidth;
14(function (ZoneWidth) {
15 ZoneWidth[ZoneWidth["Short"] = 0] = "Short";
16 ZoneWidth[ZoneWidth["ShortGMT"] = 1] = "ShortGMT";
17 ZoneWidth[ZoneWidth["Long"] = 2] = "Long";
18 ZoneWidth[ZoneWidth["Extended"] = 3] = "Extended";
19})(ZoneWidth || (ZoneWidth = {}));
20var DateType;
21(function (DateType) {
22 DateType[DateType["FullYear"] = 0] = "FullYear";
23 DateType[DateType["Month"] = 1] = "Month";
24 DateType[DateType["Date"] = 2] = "Date";
25 DateType[DateType["Hours"] = 3] = "Hours";
26 DateType[DateType["Minutes"] = 4] = "Minutes";
27 DateType[DateType["Seconds"] = 5] = "Seconds";
28 DateType[DateType["FractionalSeconds"] = 6] = "FractionalSeconds";
29 DateType[DateType["Day"] = 7] = "Day";
30})(DateType || (DateType = {}));
31var TranslationType;
32(function (TranslationType) {
33 TranslationType[TranslationType["DayPeriods"] = 0] = "DayPeriods";
34 TranslationType[TranslationType["Days"] = 1] = "Days";
35 TranslationType[TranslationType["Months"] = 2] = "Months";
36 TranslationType[TranslationType["Eras"] = 3] = "Eras";
37})(TranslationType || (TranslationType = {}));
38/**
39 * @ngModule CommonModule
40 * @description
41 *
42 * Formats a date according to locale rules.
43 *
44 * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)
45 * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
46 * @param format The date-time components to include. See `DatePipe` for details.
47 * @param locale A locale code for the locale format rules to use.
48 * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`),
49 * or a standard UTC/GMT or continental US time zone abbreviation.
50 * If not specified, uses host system settings.
51 *
52 * @returns The formatted date string.
53 *
54 * @see `DatePipe`
55 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n-overview)
56 *
57 * @publicApi
58 */
59export function formatDate(value, format, locale, timezone) {
60 let date = toDate(value);
61 const namedFormat = getNamedFormat(locale, format);
62 format = namedFormat || format;
63 let parts = [];
64 let match;
65 while (format) {
66 match = DATE_FORMATS_SPLIT.exec(format);
67 if (match) {
68 parts = parts.concat(match.slice(1));
69 const part = parts.pop();
70 if (!part) {
71 break;
72 }
73 format = part;
74 }
75 else {
76 parts.push(format);
77 break;
78 }
79 }
80 let dateTimezoneOffset = date.getTimezoneOffset();
81 if (timezone) {
82 dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
83 date = convertTimezoneToLocal(date, timezone, true);
84 }
85 let text = '';
86 parts.forEach(value => {
87 const dateFormatter = getDateFormatter(value);
88 text += dateFormatter ?
89 dateFormatter(date, locale, dateTimezoneOffset) :
90 value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
91 });
92 return text;
93}
94/**
95 * Create a new Date object with the given date value, and the time set to midnight.
96 *
97 * We cannot use `new Date(year, month, date)` because it maps years between 0 and 99 to 1900-1999.
98 * See: https://github.com/angular/angular/issues/40377
99 *
100 * Note that this function returns a Date object whose time is midnight in the current locale's
101 * timezone. In the future we might want to change this to be midnight in UTC, but this would be a
102 * considerable breaking change.
103 */
104function createDate(year, month, date) {
105 // The `newDate` is set to midnight (UTC) on January 1st 1970.
106 // - In PST this will be December 31st 1969 at 4pm.
107 // - In GMT this will be January 1st 1970 at 1am.
108 // Note that they even have different years, dates and months!
109 const newDate = new Date(0);
110 // `setFullYear()` allows years like 0001 to be set correctly. This function does not
111 // change the internal time of the date.
112 // Consider calling `setFullYear(2019, 8, 20)` (September 20, 2019).
113 // - In PST this will now be September 20, 2019 at 4pm
114 // - In GMT this will now be September 20, 2019 at 1am
115 newDate.setFullYear(year, month, date);
116 // We want the final date to be at local midnight, so we reset the time.
117 // - In PST this will now be September 20, 2019 at 12am
118 // - In GMT this will now be September 20, 2019 at 12am
119 newDate.setHours(0, 0, 0);
120 return newDate;
121}
122function getNamedFormat(locale, format) {
123 const localeId = getLocaleId(locale);
124 NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
125 if (NAMED_FORMATS[localeId][format]) {
126 return NAMED_FORMATS[localeId][format];
127 }
128 let formatValue = '';
129 switch (format) {
130 case 'shortDate':
131 formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
132 break;
133 case 'mediumDate':
134 formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
135 break;
136 case 'longDate':
137 formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
138 break;
139 case 'fullDate':
140 formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
141 break;
142 case 'shortTime':
143 formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
144 break;
145 case 'mediumTime':
146 formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
147 break;
148 case 'longTime':
149 formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
150 break;
151 case 'fullTime':
152 formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
153 break;
154 case 'short':
155 const shortTime = getNamedFormat(locale, 'shortTime');
156 const shortDate = getNamedFormat(locale, 'shortDate');
157 formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
158 break;
159 case 'medium':
160 const mediumTime = getNamedFormat(locale, 'mediumTime');
161 const mediumDate = getNamedFormat(locale, 'mediumDate');
162 formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
163 break;
164 case 'long':
165 const longTime = getNamedFormat(locale, 'longTime');
166 const longDate = getNamedFormat(locale, 'longDate');
167 formatValue =
168 formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
169 break;
170 case 'full':
171 const fullTime = getNamedFormat(locale, 'fullTime');
172 const fullDate = getNamedFormat(locale, 'fullDate');
173 formatValue =
174 formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
175 break;
176 }
177 if (formatValue) {
178 NAMED_FORMATS[localeId][format] = formatValue;
179 }
180 return formatValue;
181}
182function formatDateTime(str, opt_values) {
183 if (opt_values) {
184 str = str.replace(/\{([^}]+)}/g, function (match, key) {
185 return (opt_values != null && key in opt_values) ? opt_values[key] : match;
186 });
187 }
188 return str;
189}
190function padNumber(num, digits, minusSign = '-', trim, negWrap) {
191 let neg = '';
192 if (num < 0 || (negWrap && num <= 0)) {
193 if (negWrap) {
194 num = -num + 1;
195 }
196 else {
197 num = -num;
198 neg = minusSign;
199 }
200 }
201 let strNum = String(num);
202 while (strNum.length < digits) {
203 strNum = '0' + strNum;
204 }
205 if (trim) {
206 strNum = strNum.substr(strNum.length - digits);
207 }
208 return neg + strNum;
209}
210function formatFractionalSeconds(milliseconds, digits) {
211 const strMs = padNumber(milliseconds, 3);
212 return strMs.substr(0, digits);
213}
214/**
215 * Returns a date formatter that transforms a date into its locale digit representation
216 */
217function dateGetter(name, size, offset = 0, trim = false, negWrap = false) {
218 return function (date, locale) {
219 let part = getDatePart(name, date);
220 if (offset > 0 || part > -offset) {
221 part += offset;
222 }
223 if (name === DateType.Hours) {
224 if (part === 0 && offset === -12) {
225 part = 12;
226 }
227 }
228 else if (name === DateType.FractionalSeconds) {
229 return formatFractionalSeconds(part, size);
230 }
231 const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
232 return padNumber(part, size, localeMinus, trim, negWrap);
233 };
234}
235function getDatePart(part, date) {
236 switch (part) {
237 case DateType.FullYear:
238 return date.getFullYear();
239 case DateType.Month:
240 return date.getMonth();
241 case DateType.Date:
242 return date.getDate();
243 case DateType.Hours:
244 return date.getHours();
245 case DateType.Minutes:
246 return date.getMinutes();
247 case DateType.Seconds:
248 return date.getSeconds();
249 case DateType.FractionalSeconds:
250 return date.getMilliseconds();
251 case DateType.Day:
252 return date.getDay();
253 default:
254 throw new Error(`Unknown DateType value "${part}".`);
255 }
256}
257/**
258 * Returns a date formatter that transforms a date into its locale string representation
259 */
260function dateStrGetter(name, width, form = FormStyle.Format, extended = false) {
261 return function (date, locale) {
262 return getDateTranslation(date, locale, name, width, form, extended);
263 };
264}
265/**
266 * Returns the locale translation of a date for a given form, type and width
267 */
268function getDateTranslation(date, locale, name, width, form, extended) {
269 switch (name) {
270 case TranslationType.Months:
271 return getLocaleMonthNames(locale, form, width)[date.getMonth()];
272 case TranslationType.Days:
273 return getLocaleDayNames(locale, form, width)[date.getDay()];
274 case TranslationType.DayPeriods:
275 const currentHours = date.getHours();
276 const currentMinutes = date.getMinutes();
277 if (extended) {
278 const rules = getLocaleExtraDayPeriodRules(locale);
279 const dayPeriods = getLocaleExtraDayPeriods(locale, form, width);
280 const index = rules.findIndex(rule => {
281 if (Array.isArray(rule)) {
282 // morning, afternoon, evening, night
283 const [from, to] = rule;
284 const afterFrom = currentHours >= from.hours && currentMinutes >= from.minutes;
285 const beforeTo = (currentHours < to.hours ||
286 (currentHours === to.hours && currentMinutes < to.minutes));
287 // We must account for normal rules that span a period during the day (e.g. 6am-9am)
288 // where `from` is less (earlier) than `to`. But also rules that span midnight (e.g.
289 // 10pm - 5am) where `from` is greater (later!) than `to`.
290 //
291 // In the first case the current time must be BOTH after `from` AND before `to`
292 // (e.g. 8am is after 6am AND before 10am).
293 //
294 // In the second case the current time must be EITHER after `from` OR before `to`
295 // (e.g. 4am is before 5am but not after 10pm; and 11pm is not before 5am but it is
296 // after 10pm).
297 if (from.hours < to.hours) {
298 if (afterFrom && beforeTo) {
299 return true;
300 }
301 }
302 else if (afterFrom || beforeTo) {
303 return true;
304 }
305 }
306 else { // noon or midnight
307 if (rule.hours === currentHours && rule.minutes === currentMinutes) {
308 return true;
309 }
310 }
311 return false;
312 });
313 if (index !== -1) {
314 return dayPeriods[index];
315 }
316 }
317 // if no rules for the day periods, we use am/pm by default
318 return getLocaleDayPeriods(locale, form, width)[currentHours < 12 ? 0 : 1];
319 case TranslationType.Eras:
320 return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
321 default:
322 // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
323 // However Closure Compiler does not understand that and reports an error in typed mode.
324 // The `throw new Error` below works around the problem, and the unexpected: never variable
325 // makes sure tsc still checks this code is unreachable.
326 const unexpected = name;
327 throw new Error(`unexpected translation type ${unexpected}`);
328 }
329}
330/**
331 * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
332 * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
333 * extended = +04:30)
334 */
335function timeZoneGetter(width) {
336 return function (date, locale, offset) {
337 const zone = -1 * offset;
338 const minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
339 const hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
340 switch (width) {
341 case ZoneWidth.Short:
342 return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
343 padNumber(Math.abs(zone % 60), 2, minusSign);
344 case ZoneWidth.ShortGMT:
345 return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
346 case ZoneWidth.Long:
347 return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
348 padNumber(Math.abs(zone % 60), 2, minusSign);
349 case ZoneWidth.Extended:
350 if (offset === 0) {
351 return 'Z';
352 }
353 else {
354 return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
355 padNumber(Math.abs(zone % 60), 2, minusSign);
356 }
357 default:
358 throw new Error(`Unknown zone width "${width}"`);
359 }
360 };
361}
362const JANUARY = 0;
363const THURSDAY = 4;
364function getFirstThursdayOfYear(year) {
365 const firstDayOfYear = createDate(year, JANUARY, 1).getDay();
366 return createDate(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
367}
368function getThursdayThisWeek(datetime) {
369 return createDate(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
370}
371function weekGetter(size, monthBased = false) {
372 return function (date, locale) {
373 let result;
374 if (monthBased) {
375 const nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
376 const today = date.getDate();
377 result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
378 }
379 else {
380 const thisThurs = getThursdayThisWeek(date);
381 // Some days of a year are part of next year according to ISO 8601.
382 // Compute the firstThurs from the year of this week's Thursday
383 const firstThurs = getFirstThursdayOfYear(thisThurs.getFullYear());
384 const diff = thisThurs.getTime() - firstThurs.getTime();
385 result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
386 }
387 return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
388 };
389}
390/**
391 * Returns a date formatter that provides the week-numbering year for the input date.
392 */
393function weekNumberingYearGetter(size, trim = false) {
394 return function (date, locale) {
395 const thisThurs = getThursdayThisWeek(date);
396 const weekNumberingYear = thisThurs.getFullYear();
397 return padNumber(weekNumberingYear, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim);
398 };
399}
400const DATE_FORMATS = {};
401// Based on CLDR formats:
402// See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
403// See also explanations: http://cldr.unicode.org/translation/date-time
404// TODO(ocombe): support all missing cldr formats: U, Q, D, F, e, j, J, C, A, v, V, X, x
405function getDateFormatter(format) {
406 if (DATE_FORMATS[format]) {
407 return DATE_FORMATS[format];
408 }
409 let formatter;
410 switch (format) {
411 // Era name (AD/BC)
412 case 'G':
413 case 'GG':
414 case 'GGG':
415 formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
416 break;
417 case 'GGGG':
418 formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
419 break;
420 case 'GGGGG':
421 formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
422 break;
423 // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
424 case 'y':
425 formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
426 break;
427 // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
428 case 'yy':
429 formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
430 break;
431 // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
432 case 'yyy':
433 formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
434 break;
435 // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
436 case 'yyyy':
437 formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
438 break;
439 // 1 digit representation of the week-numbering year, e.g. (AD 1 => 1, AD 199 => 199)
440 case 'Y':
441 formatter = weekNumberingYearGetter(1);
442 break;
443 // 2 digit representation of the week-numbering year, padded (00-99). (e.g. AD 2001 => 01, AD
444 // 2010 => 10)
445 case 'YY':
446 formatter = weekNumberingYearGetter(2, true);
447 break;
448 // 3 digit representation of the week-numbering year, padded (000-999). (e.g. AD 1 => 001, AD
449 // 2010 => 2010)
450 case 'YYY':
451 formatter = weekNumberingYearGetter(3);
452 break;
453 // 4 digit representation of the week-numbering year (e.g. AD 1 => 0001, AD 2010 => 2010)
454 case 'YYYY':
455 formatter = weekNumberingYearGetter(4);
456 break;
457 // Month of the year (1-12), numeric
458 case 'M':
459 case 'L':
460 formatter = dateGetter(DateType.Month, 1, 1);
461 break;
462 case 'MM':
463 case 'LL':
464 formatter = dateGetter(DateType.Month, 2, 1);
465 break;
466 // Month of the year (January, ...), string, format
467 case 'MMM':
468 formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
469 break;
470 case 'MMMM':
471 formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
472 break;
473 case 'MMMMM':
474 formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
475 break;
476 // Month of the year (January, ...), string, standalone
477 case 'LLL':
478 formatter =
479 dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
480 break;
481 case 'LLLL':
482 formatter =
483 dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
484 break;
485 case 'LLLLL':
486 formatter =
487 dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
488 break;
489 // Week of the year (1, ... 52)
490 case 'w':
491 formatter = weekGetter(1);
492 break;
493 case 'ww':
494 formatter = weekGetter(2);
495 break;
496 // Week of the month (1, ...)
497 case 'W':
498 formatter = weekGetter(1, true);
499 break;
500 // Day of the month (1-31)
501 case 'd':
502 formatter = dateGetter(DateType.Date, 1);
503 break;
504 case 'dd':
505 formatter = dateGetter(DateType.Date, 2);
506 break;
507 // Day of the Week StandAlone (1, 1, Mon, Monday, M, Mo)
508 case 'c':
509 case 'cc':
510 formatter = dateGetter(DateType.Day, 1);
511 break;
512 case 'ccc':
513 formatter =
514 dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated, FormStyle.Standalone);
515 break;
516 case 'cccc':
517 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide, FormStyle.Standalone);
518 break;
519 case 'ccccc':
520 formatter =
521 dateStrGetter(TranslationType.Days, TranslationWidth.Narrow, FormStyle.Standalone);
522 break;
523 case 'cccccc':
524 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short, FormStyle.Standalone);
525 break;
526 // Day of the Week
527 case 'E':
528 case 'EE':
529 case 'EEE':
530 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
531 break;
532 case 'EEEE':
533 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
534 break;
535 case 'EEEEE':
536 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
537 break;
538 case 'EEEEEE':
539 formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
540 break;
541 // Generic period of the day (am-pm)
542 case 'a':
543 case 'aa':
544 case 'aaa':
545 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
546 break;
547 case 'aaaa':
548 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
549 break;
550 case 'aaaaa':
551 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
552 break;
553 // Extended period of the day (midnight, at night, ...), standalone
554 case 'b':
555 case 'bb':
556 case 'bbb':
557 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
558 break;
559 case 'bbbb':
560 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
561 break;
562 case 'bbbbb':
563 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
564 break;
565 // Extended period of the day (midnight, night, ...), standalone
566 case 'B':
567 case 'BB':
568 case 'BBB':
569 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
570 break;
571 case 'BBBB':
572 formatter =
573 dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
574 break;
575 case 'BBBBB':
576 formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
577 break;
578 // Hour in AM/PM, (1-12)
579 case 'h':
580 formatter = dateGetter(DateType.Hours, 1, -12);
581 break;
582 case 'hh':
583 formatter = dateGetter(DateType.Hours, 2, -12);
584 break;
585 // Hour of the day (0-23)
586 case 'H':
587 formatter = dateGetter(DateType.Hours, 1);
588 break;
589 // Hour in day, padded (00-23)
590 case 'HH':
591 formatter = dateGetter(DateType.Hours, 2);
592 break;
593 // Minute of the hour (0-59)
594 case 'm':
595 formatter = dateGetter(DateType.Minutes, 1);
596 break;
597 case 'mm':
598 formatter = dateGetter(DateType.Minutes, 2);
599 break;
600 // Second of the minute (0-59)
601 case 's':
602 formatter = dateGetter(DateType.Seconds, 1);
603 break;
604 case 'ss':
605 formatter = dateGetter(DateType.Seconds, 2);
606 break;
607 // Fractional second
608 case 'S':
609 formatter = dateGetter(DateType.FractionalSeconds, 1);
610 break;
611 case 'SS':
612 formatter = dateGetter(DateType.FractionalSeconds, 2);
613 break;
614 case 'SSS':
615 formatter = dateGetter(DateType.FractionalSeconds, 3);
616 break;
617 // Timezone ISO8601 short format (-0430)
618 case 'Z':
619 case 'ZZ':
620 case 'ZZZ':
621 formatter = timeZoneGetter(ZoneWidth.Short);
622 break;
623 // Timezone ISO8601 extended format (-04:30)
624 case 'ZZZZZ':
625 formatter = timeZoneGetter(ZoneWidth.Extended);
626 break;
627 // Timezone GMT short format (GMT+4)
628 case 'O':
629 case 'OO':
630 case 'OOO':
631 // Should be location, but fallback to format O instead because we don't have the data yet
632 case 'z':
633 case 'zz':
634 case 'zzz':
635 formatter = timeZoneGetter(ZoneWidth.ShortGMT);
636 break;
637 // Timezone GMT long format (GMT+0430)
638 case 'OOOO':
639 case 'ZZZZ':
640 // Should be location, but fallback to format O instead because we don't have the data yet
641 case 'zzzz':
642 formatter = timeZoneGetter(ZoneWidth.Long);
643 break;
644 default:
645 return null;
646 }
647 DATE_FORMATS[format] = formatter;
648 return formatter;
649}
650function timezoneToOffset(timezone, fallback) {
651 // Support: IE 11 only, Edge 13-15+
652 // IE/Edge do not "understand" colon (`:`) in timezone
653 timezone = timezone.replace(/:/g, '');
654 const requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
655 return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
656}
657function addDateMinutes(date, minutes) {
658 date = new Date(date.getTime());
659 date.setMinutes(date.getMinutes() + minutes);
660 return date;
661}
662function convertTimezoneToLocal(date, timezone, reverse) {
663 const reverseValue = reverse ? -1 : 1;
664 const dateTimezoneOffset = date.getTimezoneOffset();
665 const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
666 return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
667}
668/**
669 * Converts a value to date.
670 *
671 * Supported input formats:
672 * - `Date`
673 * - number: timestamp
674 * - string: numeric (e.g. "1234"), ISO and date strings in a format supported by
675 * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
676 * Note: ISO strings without time return a date without timeoffset.
677 *
678 * Throws if unable to convert to a date.
679 */
680export function toDate(value) {
681 if (isDate(value)) {
682 return value;
683 }
684 if (typeof value === 'number' && !isNaN(value)) {
685 return new Date(value);
686 }
687 if (typeof value === 'string') {
688 value = value.trim();
689 if (/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(value)) {
690 /* For ISO Strings without time the day, month and year must be extracted from the ISO String
691 before Date creation to avoid time offset and errors in the new Date.
692 If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
693 date, some browsers (e.g. IE 9) will throw an invalid Date error.
694 If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
695 is applied.
696 Note: ISO months are 0 for January, 1 for February, ... */
697 const [y, m = 1, d = 1] = value.split('-').map((val) => +val);
698 return createDate(y, m - 1, d);
699 }
700 const parsedNb = parseFloat(value);
701 // any string that only contains numbers, like "1234" but not like "1234hello"
702 if (!isNaN(value - parsedNb)) {
703 return new Date(parsedNb);
704 }
705 let match;
706 if (match = value.match(ISO8601_DATE_REGEX)) {
707 return isoStringToDate(match);
708 }
709 }
710 const date = new Date(value);
711 if (!isDate(date)) {
712 throw new Error(`Unable to convert "${value}" into a date`);
713 }
714 return date;
715}
716/**
717 * Converts a date in ISO8601 to a Date.
718 * Used instead of `Date.parse` because of browser discrepancies.
719 */
720export function isoStringToDate(match) {
721 const date = new Date(0);
722 let tzHour = 0;
723 let tzMin = 0;
724 // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
725 const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
726 const timeSetter = match[8] ? date.setUTCHours : date.setHours;
727 // if there is a timezone defined like "+01:00" or "+0100"
728 if (match[9]) {
729 tzHour = Number(match[9] + match[10]);
730 tzMin = Number(match[9] + match[11]);
731 }
732 dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
733 const h = Number(match[4] || 0) - tzHour;
734 const m = Number(match[5] || 0) - tzMin;
735 const s = Number(match[6] || 0);
736 // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)
737 // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`
738 // becomes `999ms`.
739 const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);
740 timeSetter.call(date, h, m, s, ms);
741 return date;
742}
743export function isDate(value) {
744 return value instanceof Date && !isNaN(value.valueOf());
745}
746//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF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IGJlZm9yZSAxMGFtKS5cbiAgICAgICAgICAgIC8vXG4gICAgICAgICAgICAvLyBJbiB0aGUgc2Vjb25kIGNhc2UgdGhlIGN1cnJlbnQgdGltZSBtdXN0IGJlIEVJVEhFUiBhZnRlciBgZnJvbWAgT1IgYmVmb3JlIGB0b2BcbiAgICAgICAgICAgIC8vIChlLmcuIDRhbSBpcyBiZWZvcmUgNWFtIGJ1dCBub3QgYWZ0ZXIgMTBwbTsgYW5kIDExcG0gaXMgbm90IGJlZm9yZSA1YW0gYnV0IGl0IGlzXG4gICAgICAgICAgICAvLyBhZnRlciAxMHBtKS5cbiAgICAgICAgICAgIGlmIChmcm9tLmhvdXJzIDwgdG8uaG91cnMpIHtcbiAgICAgICAgICAgICAgaWYgKGFmdGVyRnJvbSAmJiBiZWZvcmVUbykge1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGFmdGVyRnJvbSB8fCBiZWZvcmVUbykge1xuICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2UgeyAgLy8gbm9vbiBvciBtaWRuaWdodFxuICAgICAgICAgICAgaWYgKHJ1bGUuaG91cnMgPT09IGN1cnJlbnRIb3VycyAmJiBydWxlLm1pbnV0ZXMgPT09IGN1cnJlbnRNaW51dGVzKSB7XG4gICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH0pO1xuICAgICAgICBpZiAoaW5kZXggIT09IC0xKSB7XG4gICAgICAgICAgcmV0dXJuIGRheVBlcmlvZHNbaW5kZXhdO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICAvLyBpZiBubyBydWxlcyBmb3IgdGhlIGRheSBwZXJpb2RzLCB3ZSB1c2UgYW0vcG0gYnkgZGVmYXVs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