Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_20_15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### FormatURL

Fixed an issue where the CalculateTimeDifference script failed to parse inputs with explicit timezone.
Original file line number Diff line number Diff line change
@@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.20.14",
"currentVersion": "1.20.15",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Loading