Action

Set Timestamps

Posted by agiletortoise, Last update 3 days ago

Prompt to select a date/time, and optionally update the creation, modification, and/or accessed timestamps on the draft currently loaded in the editor.

Steps

  • script

    let p = new Prompt()
    p.title = "Set Timestamps"
    p.message = "Update the timestamps on the current draft"
    
    p.addDatePicker("date", "Date", draft.createdAt, {
    	"mode": "dateAndTime"
    })
    
    p.addSwitch("setCreated", "Set creation date", true)
    p.addSwitch("setModified", "Set modification date", true)
    p.addSwitch("setAccessed", "Set accessed date", true)
    
    p.addButton("Set")
    
    if (p.show()) {
    	let d = p.fieldValues["date"]
    	if (p.fieldValues["setCreated"]) {
    		draft.createdAt = d
    	}
    	if (p.fieldValues["setModified"]) {
    		draft.modifiedAt = d
    	}
    	if (p.fieldValues["setAccessed"]) {
    		draft.accessedAt = d
    	}
    	draft.update()
    }

Options

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