zavadil-ts-common 1.2.55 → 1.2.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,15 +19,18 @@ export class DateUtil {
19
19
  d = DateUtil.parseDate(d);
20
20
  if (!d) return '';
21
21
 
22
- const options: Intl.DateTimeFormatOptions = {
23
- year: 'numeric',
24
- month: 'long',
25
- day: 'numeric',
26
- weekday: 'long',
27
- ...(showTime && { hour: 'numeric', minute: 'numeric', second: 'numeric' }),
28
- };
29
-
30
- return new Intl.DateTimeFormat(undefined, options).format(d);
22
+ const year = d.getFullYear();
23
+ const month = DateUtil.formatNumber(d.getMonth() + 1);
24
+ const day = DateUtil.formatNumber(d.getDate());
25
+
26
+ if (!showTime) {
27
+ return `${year}-${month}-${day}`;
28
+ }
29
+
30
+ const hours = DateUtil.formatNumber(d.getHours());
31
+ const minutes = DateUtil.formatNumber(d.getMinutes());
32
+ const seconds = DateUtil.formatNumber(d.getSeconds());
33
+ return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
31
34
  }
32
35
 
33
36
  static formatDateTimeForHumans(d: Date | string | null | undefined): string {