getTextAsDate

getTextAsDate(): Date;

The getTextAsDate method returns the text from the textUser property of a JadeEditMask control converted to a Date value.

If the mask property does not specify that the data is a full date field (for example, ddMMMyyyy or dd/MM/yyyy) or if the date data is incomplete but not empty, an exception is raised.

Use the isEmpty and isValid methods to prevent incomplete date data from generating an exception.

By default, a JadeEditMask control expects dates to be formatted according to the locale that the control is using (for details, see the languageId property). This applies when accessing the text or textUser property and when the user enters data.

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.

When the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file on the database node is set to true, the JadeEditMask class validates the setting and entry of text based on the mask property, using the current locale of the client with regional overrides on both the presentation client and the application server. When the parameter 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.

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