Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 23 additions & 0 deletions Scripts/DateToMillis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
{
"api":1,
"name":"Date to Milliseconds",
"description":"Converts a date to milliseconds since the UNIX epoch.",
"author":"Seth Soffer",
"icon":"watch",
"tags":"date,unix,milliseconds,timestamp",
}
**/
function main(state){
try{
const parsedDate = Date.parse(state.text);
if (isNaN(parsedDate)){
state.postError("Invalid date.");
return;
}
state.text = parsedDate;
}
catch (error){
state.postError("Error parsing date.");
}
}
17 changes: 17 additions & 0 deletions Scripts/TrimQueryStringFromUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
{
"api":1,
"name":"Trim Query String from URL",
"description":"Cleans up a URL by removing the query string.",
"author":"Seth Soffer",
"icon":"link",
"tags":"url,trim,querystring,query string",
}
**/
function main(state){
const url = state.text;
const queryIndex = url.indexOf('?');
if(queryIndex > -1){
state.text = url.slice(0, queryIndex);
}
}