1 | import {
|
2 | LocalizeController
|
3 | } from "./chunk.6WMYSCDC.js";
|
4 | import {
|
5 | e,
|
6 | n
|
7 | } from "./chunk.VKNZYXSO.js";
|
8 | import {
|
9 | $,
|
10 | s
|
11 | } from "./chunk.WWAD5WF4.js";
|
12 | import {
|
13 | __decorateClass
|
14 | } from "./chunk.K2NRSETB.js";
|
15 |
|
16 |
|
17 | var SlFormatDate = class extends s {
|
18 | constructor() {
|
19 | super(...arguments);
|
20 | this.localize = new LocalizeController(this);
|
21 | this.date = new Date();
|
22 | this.hourFormat = "auto";
|
23 | }
|
24 | render() {
|
25 | const date = new Date(this.date);
|
26 | const hour12 = this.hourFormat === "auto" ? void 0 : this.hourFormat === "12";
|
27 | if (isNaN(date.getMilliseconds())) {
|
28 | return void 0;
|
29 | }
|
30 | return $`
|
31 | <time datetime=${date.toISOString()}>
|
32 | ${this.localize.date(date, {
|
33 | weekday: this.weekday,
|
34 | era: this.era,
|
35 | year: this.year,
|
36 | month: this.month,
|
37 | day: this.day,
|
38 | hour: this.hour,
|
39 | minute: this.minute,
|
40 | second: this.second,
|
41 | timeZoneName: this.timeZoneName,
|
42 | timeZone: this.timeZone,
|
43 | hour12
|
44 | })}
|
45 | </time>
|
46 | `;
|
47 | }
|
48 | };
|
49 | __decorateClass([
|
50 | e()
|
51 | ], SlFormatDate.prototype, "date", 2);
|
52 | __decorateClass([
|
53 | e()
|
54 | ], SlFormatDate.prototype, "lang", 2);
|
55 | __decorateClass([
|
56 | e()
|
57 | ], SlFormatDate.prototype, "weekday", 2);
|
58 | __decorateClass([
|
59 | e()
|
60 | ], SlFormatDate.prototype, "era", 2);
|
61 | __decorateClass([
|
62 | e()
|
63 | ], SlFormatDate.prototype, "year", 2);
|
64 | __decorateClass([
|
65 | e()
|
66 | ], SlFormatDate.prototype, "month", 2);
|
67 | __decorateClass([
|
68 | e()
|
69 | ], SlFormatDate.prototype, "day", 2);
|
70 | __decorateClass([
|
71 | e()
|
72 | ], SlFormatDate.prototype, "hour", 2);
|
73 | __decorateClass([
|
74 | e()
|
75 | ], SlFormatDate.prototype, "minute", 2);
|
76 | __decorateClass([
|
77 | e()
|
78 | ], SlFormatDate.prototype, "second", 2);
|
79 | __decorateClass([
|
80 | e({ attribute: "time-zone-name" })
|
81 | ], SlFormatDate.prototype, "timeZoneName", 2);
|
82 | __decorateClass([
|
83 | e({ attribute: "time-zone" })
|
84 | ], SlFormatDate.prototype, "timeZone", 2);
|
85 | __decorateClass([
|
86 | e({ attribute: "hour-format" })
|
87 | ], SlFormatDate.prototype, "hourFormat", 2);
|
88 | SlFormatDate = __decorateClass([
|
89 | n("sl-format-date")
|
90 | ], SlFormatDate);
|
91 |
|
92 | export {
|
93 | SlFormatDate
|
94 | };
|