Drafts Action Directory

Open Sorted (date)

Posted by kjaymiller, Last update 10 days ago

V 1.01 UPDATE :

FIX - Issue where Sorted opened to day after selected date

Prompts for a date and the opens Sorted 3 to the selected date.

Install

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    menu = Prompt.create();
    menu.title = 'Select a Date';
    menu.message = 'Select the Day you wish to open in Sorted'
    menu.addDatePicker('selectedDate','Date',new Date, {'mode':'date'});
    menu.addButton('ok', 'Open Sorted');
    
    m = menu.show();
    
    
    if (m){
    
    let selectedDate = menu.fieldValues['selectedDate'];
    
    
    let formattedDate = [selectedDate.getFullYear(), selectedDate.getMonth() + 1, selectedDate.getDate()].join('-');
    
    draft.setTemplateTag('selectedDate',formattedDate)
    }
    
    else
    
    {
    context.cancel('Action cancelled')
    }
  • url

    template
    sorted://x-callback-url/open?date=[[selectedDate]]
    useSafari
    false
    encodeTags
    true

Options

  • After Success Default
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.