feat(runtime): Date To String node, add "yearShort" format (#29)

This commit is contained in:
Eric Tuvesson
2024-06-02 16:55:39 +02:00
committed by GitHub
parent 1a048587d9
commit d67afd3c60

View File

@@ -59,6 +59,7 @@ const DateToStringNode = {
const month = ('0' + (t.getMonth() + 1)).slice(-2);
const monthShort = new Intl.DateTimeFormat('en-US', { month: 'short' }).format(t);
const year = t.getFullYear();
const yearShort = year.toString().substring(2);
const hours = ('0' + t.getHours()).slice(-2);
const minutes = ('0' + t.getMinutes()).slice(-2);
const seconds = ('0' + t.getSeconds()).slice(-2);
@@ -68,6 +69,7 @@ const DateToStringNode = {
.replace(/\{month\}/g, month)
.replace(/\{monthShort\}/g, monthShort)
.replace(/\{year\}/g, year)
.replace(/\{yearShort\}/g, yearShort)
.replace(/\{hours\}/g, hours)
.replace(/\{minutes\}/g, minutes)
.replace(/\{seconds\}/g, seconds);