feat(formatter/format-date-time): add unix to datetime support
This commit is contained in:
@@ -5,11 +5,24 @@ const formatDateTime = ($) => {
|
|||||||
|
|
||||||
const fromFormat = $.step.parameters.fromFormat;
|
const fromFormat = $.step.parameters.fromFormat;
|
||||||
const fromTimezone = $.step.parameters.fromTimezone;
|
const fromTimezone = $.step.parameters.fromTimezone;
|
||||||
|
let inputDateTime;
|
||||||
|
|
||||||
const inputDateTime = DateTime.fromFormat(input, fromFormat, {
|
if (fromFormat === 'X') {
|
||||||
zone: fromTimezone,
|
inputDateTime = DateTime.fromSeconds(Number(input), fromFormat, {
|
||||||
setZone: true,
|
zone: fromTimezone,
|
||||||
});
|
setZone: true,
|
||||||
|
});
|
||||||
|
} else if (fromFormat === 'x') {
|
||||||
|
inputDateTime = DateTime.fromMillis(Number(input), fromFormat, {
|
||||||
|
zone: fromTimezone,
|
||||||
|
setZone: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
inputDateTime = DateTime.fromFormat(input, fromFormat, {
|
||||||
|
zone: fromTimezone,
|
||||||
|
setZone: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const toFormat = $.step.parameters.toFormat;
|
const toFormat = $.step.parameters.toFormat;
|
||||||
const toTimezone = $.step.parameters.toTimezone;
|
const toTimezone = $.step.parameters.toTimezone;
|
||||||
|
Reference in New Issue
Block a user