Action

Localized Day Name

Posted by agiletortoise, Last update about 1 month ago

Example script which can be incorporated into other actions to create tamplate tags with localized versions of day names.

Include this script in another action, and it will create a [[day]] template tag with the localized name of the day of the week which can be used it later action steps in the same action.

Edit the dayNames array to contain the names (or abbreviations) you would like returned for each day of the week, starting with Sunday.

Steps

  • script

    // Edit this array's values to contain the 
    // localized versions of the day names you want set
    let dayNames = [
    	'Sunday',
    	'Monday',
    	'Tuesday',
    	'Wednesday',
    	'Thursday',
    	'Friday',
    	'Saturday'
    ];
    
    let getDayName = (d) => {
    	let dNum = d.getDay();
    	return dayNames[dNum];
    }
    
    let now = new Date();
    let dayName = getDayName(now)
    draft.setTemplateTag("day", dayName);
    

Options

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