EliJDonahue of Aras Labs
2/15/2017 - 6:45 PM

Demonstrates how to call a datepicker dialog via method code and perform some logic with the selected date.

Demonstrates how to call a datepicker dialog via method code and perform some logic with the selected date.

// Prompt the user for the baseline date
var dateFormat = "yyyy-MM-dd HH:mm:ss";
var baseDate = new Date().format(dateFormat);
params = {
    aras: top.aras,
    format: dateFormat,
    type: "Date",
    date: baseDate
};

// call the date dialog with defined params
return aras.getMainWindow().main.ArasModules.Dialog.show("iframe", params).promise.then(function(res) {
    // do something with the date on the dialog's callback
    return doSomethingWithTheDate(res);
});

// write a function to do some logic with the date
function doSomethingWithTheDate(dt) {
    alert(dt);
}