getTextAsShortDate

getTextAsShortDate(): Date;

The getTextAsShortDate method returns the text in short date format from the text property of a TextBox control converted to a Date value.

If the text box is empty, null is returned. If the text is not a valid short date, an exception is raised. Use the isValid method to prevent incomplete date data from generating an exception.

By default, a TextBox control expects dates to be formatted according to the locale that the control is using. This applies when accessing the text property and when the user enters data.

When the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file is not defined or it is set to false, inconsistent results could be returned to the application server when running in JADE thin client mode and there are regional overrides, as all overrides on the application server are suppressed if enhanced locale support is not enabled. By default, formatting of locale data is done on the application server, based on the locale of the corresponding presentation client. For example, if the locale of your application server is set to English (United Kingdom), which has a default short date format of dd/MM/yyyy, and it has been overridden with a short date format of yyyy-MM-dd, this is returned in the default dd/MM/yyyy format.

Setting date text by using the setTextFromShortDate method converts the short date into the appropriate string for that locale. Retrieving the short date value by using the getTextAsShortDate method does the reverse. You can therefore use the getTextAsShortDate and setTextFromShortDate methods to access short date text so that JADE handles the locale format for you.