Action

Revise End of Title Dates to ISO

Posted by sylumer, Last update almost 3 years ago - Unlisted

Steps

  • script

    let astrTitle = draft.title.split(" ");
    let strDate = astrTitle[astrTitle.length - 1];
    //Only process if it looks like we have a date
    if ((strDate.match(/\//g) || []).length == 2)
    {
    	//Build the new date
    	let astrDate = strDate.split("/");
    	let strDay = ("0" + astrDate[0]).slice(-2);
    	let strMonth = ("0" + astrDate[1]).slice(-2);
    	let strYear = ("20" + astrDate[2]).slice(-4);
    	
    	//Rebuild and replace the draft title
    	let astrContent = draft.lines;
    	astrTitle[astrTitle.length - 1] = strYear + "-" + strMonth + "-" + strDay;
    	astrContent[0] = astrTitle.join(" ");
    	draft.content = astrContent.join("\n");
    	draft.update();
    }

Options

  • After Success Default
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.