Merge pull request #2345 from automatisch/timestamp-in-seconds

feat(formatter/date-time): add get current timestamp in seconds
This commit is contained in:
Ömer Faruk Aydın
2025-02-13 10:37:03 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -1,10 +1,12 @@
import defineAction from '../../../../helpers/define-action.js'; import defineAction from '../../../../helpers/define-action.js';
import formatDateTime from './transformers/format-date-time.js'; import formatDateTime from './transformers/format-date-time.js';
import getCurrentTimestamp from './transformers/get-current-timestamp.js'; import getCurrentTimestamp from './transformers/get-current-timestamp.js';
import getCurrentTimestampInSeconds from './transformers/get-current-timestamp-in-seconds.js';
const transformers = { const transformers = {
formatDateTime, formatDateTime,
getCurrentTimestamp, getCurrentTimestamp,
getCurrentTimestampInSeconds,
}; };
export default defineAction({ export default defineAction({
@@ -23,6 +25,10 @@ export default defineAction({
label: 'Get current timestamp', label: 'Get current timestamp',
value: 'getCurrentTimestamp', value: 'getCurrentTimestamp',
}, },
{
label: 'Get current timestamp in seconds',
value: 'getCurrentTimestampInSeconds',
},
{ {
label: 'Format Date / Time', label: 'Format Date / Time',
value: 'formatDateTime', value: 'formatDateTime',

View File

@@ -0,0 +1,5 @@
const getCurrentTimestampInSeconds = () => {
return Math.floor(Date.now() / 1000);
};
export default getCurrentTimestampInSeconds;