diff --git a/Packs/CommonScripts/ReleaseNotes/1_20_17.md b/Packs/CommonScripts/ReleaseNotes/1_20_17.md new file mode 100644 index 000000000000..be12b928f35b --- /dev/null +++ b/Packs/CommonScripts/ReleaseNotes/1_20_17.md @@ -0,0 +1,6 @@ + +#### Scripts + +##### FormatURL + +Fixed an issue where the CalculateTimeDifference script failed to parse inputs with an explicit timezone. diff --git a/Packs/CommonScripts/Scripts/CalculateTimeDifference/CalculateTimeDifference.js b/Packs/CommonScripts/Scripts/CalculateTimeDifference/CalculateTimeDifference.js index 09795c61783b..af8d49387deb 100644 --- a/Packs/CommonScripts/Scripts/CalculateTimeDifference/CalculateTimeDifference.js +++ b/Packs/CommonScripts/Scripts/CalculateTimeDifference/CalculateTimeDifference.js @@ -1,32 +1,7 @@ - function isValidTimestampFormat(timestamp) { - // the valid Timestamp Format is in ISO 8601 "yyyy-MM-dd'T'HH:mm:ss" for example : 2020-01-01T00:01:00 - const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/; - return regex.test(timestamp); - } - - - try { - + try { var start_time = args.start_time.replace(/"/g, ""); var end_time = args.end_time.replace(/"/g, ""); - // Validate params format - if (!isValidTimestampFormat(start_time)) { - return { - ContentsFormat: formats.markdown, - Type: entryTypes.error, - Contents: "start_time argument does not match format '%Y-%m-%dT%H:%M:%S'" - }; - } - - if (!isValidTimestampFormat(end_time)) { - return { - ContentsFormat: formats.markdown, - Type: entryTypes.error, - Contents: "end_time argument does not match format '%Y-%m-%dT%H:%M:%S'" - }; - } - // Strip microseconds and parse the datetime var startTimeObj = new Date(start_time.split(".")[0]); var endTimeObj = new Date(end_time.split(".")[0]); diff --git a/Packs/CommonScripts/pack_metadata.json b/Packs/CommonScripts/pack_metadata.json index 81e5868907fd..5f7b08fe220f 100644 --- a/Packs/CommonScripts/pack_metadata.json +++ b/Packs/CommonScripts/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Common Scripts", "description": "Frequently used scripts pack.", "support": "xsoar", - "currentVersion": "1.20.16", + "currentVersion": "1.20.17", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",