Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

515 B
Raw Blame
import dayjs from 'dayjs'
import timezone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
import { ProcessorFn } from './types'

export const dateTimeProcessor: ProcessorFn = (_property, value) => {
    dayjs.extend(utc)
    dayjs.extend(timezone)
    const dateTimeString = value
    try {
        if (!dateTimeString) throw Error('Undefined input')
        return dayjs.tz(dateTimeString, 'UTC').toISOString()
    }
    catch (error) {
        console.error(error)
        return undefined
    }
}