Logo

    Home

    Documentation

    Use Cases

    Training

    Applications

    Release Notes

    Set Date field of a form to today

    Set Date field of a form to today

    icon

    Set the date field to todays date filed

    • 1. Summary
    • 2. Result
    • 3. Step by Step Guide
    • 4. Documentation

    1. Summary

    You can use a type script file to change the date field to todays date

    2. Result

    The date field will show the today’s date in the cell

    3. Step by Step Guide

    Put the function to the form on the eventAfterDisplay with the value #.MyDate(eventSource )

    4. Documentation

    To find more information, you can check the following documentation.

    FormsForms

    Back to Use CasesUse Cases

    Back to Home Page

    Logo
    export function MyDate(Form: akioma.swat.Form) {
        // Retrieve the existing date from the form
        const dateField: Date = new Date();
    
        // Create a new date for today
        const today: Date = new Date();
    
        // Update the year, month, and day of the date field
        dateField.setFullYear(today.getFullYear(), today.getMonth(), today.getDate());
    
        // Save the updated date back in the form
        Form.setDataValue('MyDatefield', dateField);
    }