UNPKG

@joshfarrant/shortcuts-js

Version:
25 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../utils"); /** * @action Format Date * @section Content Types > Calendar > Dates * @icon Date * * Formats a date and time into text. * * ```js * formatDate({ * dateFormat: 'Custom', * formatString: 'HH:mm', * }); * ``` */ const formatDate = ({ dateFormat = 'Short', timeFormat = 'Short', alternativeFormat = 'Medium', includeISO8601Time = false, formatString = 'EEE, dd MMM yyyy HH:mm:ss Z', }) => ({ WFWorkflowActionIdentifier: 'is.workflow.actions.format.date', WFWorkflowActionParameters: Object.assign(Object.assign(Object.assign(Object.assign({ WFDateFormatStyle: dateFormat }, (dateFormat !== 'RFC 2822' && dateFormat !== 'ISO 8601' && dateFormat !== 'Custom' && { WFTimeFormatStyle: timeFormat })), (dateFormat === 'Relative' && { WFRelativeDateFormatStyle: alternativeFormat })), (dateFormat === 'ISO 8601' && { WFISO8601IncludeTime: includeISO8601Time })), (dateFormat === 'Custom' && { WFDateFormat: formatString })), }); exports.default = utils_1.withActionOutput(formatDate); //# sourceMappingURL=formatDate.js.map