Allowing input of alternative date formats

Contains tips for configurators working with Aware IM
Post Reply
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

Allowing input of alternative date formats

Post by UnionSystems »

This came from a client requesting the ability to enter dates without having to type a delimiter (eg enter 230617 rather than the required date format of 23/06/2017).

In the configuration tool add the following code to Presentation > Advanced for the date field

Code: Select all

config.config.parseFormats =  [ "dd-MM-yyyy",  "ddMMyyyy", "ddMMyy" ];

Then the user will be able to input the following strings to represent 23/06/2017
23-06-2017
23062017
230617
Note the sequence of the formats is important as the first one to match is used.

Rather than doing this for every date field in your business space you can create this as a single javascript function in your CUSTOM/JS folder

Code: Select all

function AllowedDateFormats(dateField) {
dateField.parseFormats =  [ "dd-MM-yyyy",  "ddMMyyyy", "ddMMyy" ];
}

Then call it from all the date fields by inserting the following in the configuration tool Presentation > Advanced

Code: Select all

AllowedDateFormats(config.config);
AWS Linux, Windows Server, AIM 8.4 & 8.6
Post Reply