From d302aaa79fdd524d7d3a27d60c139d4ada037dc3 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Wed, 3 Apr 2024 19:47:26 +0900 Subject: [PATCH] Add date and time formatting cbs --- src/ts/parser.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 6f5a92fe..6bae79c1 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -574,6 +574,22 @@ const matcher = (p1:string,matcherArg:matcherArg) => { //output date in format like Aug 23, 2021 return date.toLocaleDateString() } + case 'time':{ + const now = new Date() + return `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}` + } + case 'date':{ + const now = new Date() + return `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}` + } + case 'isotime':{ + const now = new Date() + return `${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}` + } + case 'isodate':{ + const now = new Date() + return `${now.getUTCFullYear()}-${now.getUTCMonth() + 1}-${now.getUTCDate()}` + } case 'idle_duration':{ if(matcherArg.tokenizeAccurate){ return `00:00:00`