DateEdit Class Reference

The DateEdit JavaScript class. A simplified version of the DateEdit Qt widget. More...

Properties

int order
 Whether the date order shown is DMY, MDY, YMD, or YDM. More...
 
QDate date
 The date shown. More...
 
QDate minimum
 The minimum date allowed by DateEdit. More...
 
QDate maximum
 The maximum date allowed by DateEdit. More...
 

Detailed Description

The DateEdit JavaScript class. A simplified version of the DateEdit Qt widget.

var myDialog = new Dialog();
myDialog.title = "DateEdit Example";
var userInput = new DateEdit();
//YMD means the order will be changed to Year:Month:Day in the dialog.
//The possible orders are DMY, MDY, YMD, YDM.
userInput.order = DateEditEnum.YMD;
var min = new Date( 2010, 1, 1 );
var max = new Date( 2019, 12, 31 );
var now = new Date();
userInput.date = now;
userInput.minimum = min;
userInput.maximum = max;
userInput.label = "Pick a date from this decade: ";
myDialog.add( userInput );
if ( myDialog.exec() )
{
var inputDate = userInput.date;
var day = inputDate.getDate();
var month = inputDate.getMonth() + 1;
var year = inputDate.getFullYear();
MessageLog.trace("The selected date is " + day + "/" + month + "/" + year + ".");
}

Property Documentation

◆ date

QDate DateEdit::date
readwrite

The date shown.

◆ maximum

QDate DateEdit::maximum
readwrite

The maximum date allowed by DateEdit.

◆ minimum

QDate DateEdit::minimum
readwrite

The minimum date allowed by DateEdit.

◆ order

int DateEdit::order
readwrite

Whether the date order shown is DMY, MDY, YMD, or YDM.