Action

Bujo Future Log

Posted by mark_boerger, Last update 20 days ago

Lists the next six months with asterisks under each to mark events.

Steps

  • script

    // See online documentation for examples
    // https://docs.getdrafts.com/docs/actions/scripting
    
    // Get today's date
    let today = new Date();
    let output = "## Future Log\n\n"; // Add header
    
    // Loop through the next six months (excluding the current month)
    for (let i = 1; i <= 6; i++) {
        let futureDate = new Date(today.getFullYear(), today.getMonth() + i, 1);
        let monthName = futureDate.toLocaleString('default', { month: 'long' });
        let year = futureDate.getFullYear();
        
        // Append each month with an asterisk and space underneath
        output += `${monthName} ${year}\n*\n\n`;
    }
    
    // Set the Drafts document content
    draft.content = output;
    draft.update();

Options

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