Skip to content

Commit 9aedf90

Browse files
committed
use Temporal.PlainDate.from
1 parent 4977e54 commit 9aedf90

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

web_src/js/webcomponents/absolute-date.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ window.customElements.define('absolute-date', class extends HTMLElement {
1212
this.ownerDocument.documentElement.getAttribute('lang') ||
1313
'';
1414

15-
// only extract the first 10 characters, e.g. the `yyyy-mm-dd` part
16-
const [isoYear, isoMonth, isoDate] = this.getAttribute('date').substring(0, 10).split('-');
17-
const plainDate = new Temporal.PlainDate(isoYear, isoMonth, isoDate);
15+
// only use the first 10 characters, e.g. the `yyyy-mm-dd` part
16+
const plainDate = Temporal.PlainDate.from(this.getAttribute('date').substring(0, 10));
1817
if (!this.shadowRoot) this.attachShadow({mode: 'open'});
1918
this.shadowRoot.textContent = plainDate.toLocaleString(lang ?? [], {
2019
...(year && {year}),

0 commit comments

Comments
 (0)