diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index f7d24f09..f8fdaa8e 100755 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -2224,7 +2224,7 @@ const OperationConfig = { ] }, "To UNIX Timestamp": { - description: "Parses a datetime string and returns the corresponding UNIX timestamp.

e.g. Mon 1 January 2001 11:00:00 UTC becomes 978346800", + description: "Parses a datetime string in UTC and returns the corresponding UNIX timestamp.

e.g. Mon 1 January 2001 11:00:00 becomes 978346800", run: DateTime.runToUnixTimestamp, inputType: "string", outputType: "number", @@ -2233,6 +2233,11 @@ const OperationConfig = { name: "Units", type: "option", value: DateTime.UNITS + }, + { + name: "Treat as UTC", + type: "boolean", + value: DateTime.TREAT_AS_UTC } ] }, diff --git a/src/core/operations/DateTime.js b/src/core/operations/DateTime.js index 345eb544..523206b2 100755 --- a/src/core/operations/DateTime.js +++ b/src/core/operations/DateTime.js @@ -46,6 +46,12 @@ const DateTime = { }, + /** + * @constant + * @default + */ + TREAT_AS_UTC: true, + /** * To UNIX Timestamp operation. * @@ -55,7 +61,8 @@ const DateTime = { */ runToUnixTimestamp: function(input, args) { let units = args[0], - d = moment(input); + treatAsUTC = args[1], + d = treatAsUTC ? moment.utc(input) : moment(input); if (units === "Seconds (s)") { return d.unix();