Compare commits

...
3 Commits
Author SHA1 Message Date
n1474335 d87b14af13 5.4.1 2017-05-17 14:45:19 +00:00
n1474335 83623d23cf Merge branch 'bug-timestamp' 2017-05-17 14:45:10 +00:00
n1474335 07fba53b73 'To UNIX Timestamp' operation now defaults to UTC instead of your local timezone. 2017-05-17 14:37:36 +00:00
3 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "5.4.0",
"version": "5.4.1",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
+6 -1
View File
@@ -2224,7 +2224,7 @@ const OperationConfig = {
]
},
"To UNIX Timestamp": {
description: "Parses a datetime string and returns the corresponding UNIX timestamp.<br><br>e.g. <code>Mon 1 January 2001 11:00:00 UTC</code> becomes <code>978346800</code>",
description: "Parses a datetime string in UTC and returns the corresponding UNIX timestamp.<br><br>e.g. <code>Mon 1 January 2001 11:00:00</code> becomes <code>978346800</code>",
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
}
]
},
+8 -1
View File
@@ -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();