Batch attribute editor; Change date format?

3349
14
09-26-2016 02:47 PM
HamishMills
Occasional Contributor

Hello,

Is there a way to change the Batch attribute editor date format when entering date values? It seems to be locked to MM/DD/YYYY. I want to use the format DD/MM/YYYY. 

Any help is appreciated.

Lemao Wu‌  rscheitlinad_giles@hotmail.com

0 Kudos
14 Replies
HamishMills
Occasional Contributor

Thanks Previn,

 

This code works partially but all I really need is the section of code that will stop the field from locking the save button when users enter dates in the DD/MM/YYYY format. The date picker doesn't actually function so using the date picker is not an option at this point. Users will be typing the date in manually until the new release comes out. 

 

In any case, I understand I've taken a lot of your time on this issue so I'm happy to wait for the new release, as long as its coming out in the first 2 weeks of October. 

 

Thanks again

Hamish

0 Kudos
PrevinWong1
Esri Contributor

Hamish,

Since you want to enable the Save button, even in the case of invalid date, you need to follow the trail for this

html.addClass(saveBtn, 'jimu-state-disabled');

And comment out where it occurs (there's a few)

Then in the function

_getComboBoxVal: function (pParams) {

Add this code

html.removeClass(saveBtn, 'jimu-state-disabled');

This code controls the red outline in the textbox, just remove the logic statement and leave the else condition.

if (valid === false) {
 domClass.add(comboBox.domNode, ["dijitTextBoxError", "dijitComboBoxError",
 "dijitError", "dijitValidationTextBoxError"]);
 } else {
domClass.remove(comboBox.domNode, ["dijitTextBoxError", "dijitComboBoxError",
 "dijitError", "dijitValidationTextBoxError"]);
 }

What you basically have done is remove all validation on the textbox, so you can save button is permanently enabled. I still suggest anywhere you have a date, to still put a mask so that things look right to you.

evtJustDate = locale.format(dtValue, { selector: 'date', fullYear: true, datePattern : 'd/M/yyyy' });

HamishMills
Occasional Contributor

Hi Previn

I have recently downloaded the latest WebApp Builder Dev version 2.2. However on initial testing I have found that the date format has not been updated. I still find that once I have selected a date from the date picker it shows in the incorrect format (MM/DD/YYYY). 

Unless I am incorrect, is the date field now something that should reflect my local date format?

Cheers

Hamish

0 Kudos
PrevinWong1
Esri Contributor

Hamish,

Yes, the new release should base the date format on the locale now.  But it does not override if you want to force it to a different format.  for example, in the US, it's MM/DD/YYYY.  If I try to put an date pattern of DD/MM/YYYY, it still will not validate, seems to be a bug with the underlying Dojo framework.

You will still need to disable the validation using the steps above if you need to override the local format.

0 Kudos
HamishMills
Occasional Contributor

Hi again PWong-esristaff‌,

I have done everything I can to make sure that my locale is set correctly, however the incorrect date format (MM/DD/YYYY) is still the only option allowed by the field input. Are you certain that the Batch Attribute Editor widget is affected by this update? I've noted that the date picker is now fixed and works correctly however the date format still doesn't reflect my 'locale' correctly and I am unable to override this.

Cheers

Hamish

0 Kudos