Skip to content

Commit

Permalink
feat(runtime): Date To String node, add "yearShort" format (noodlapp#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
erictuvesson authored and Richard Osborne committed Aug 14, 2024
1 parent 509e967 commit 610f2bb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/noodl-runtime/src/nodes/std-library/datetostring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 610f2bb

Please sign in to comment.