Opened 6 years ago

Last modified 2 years ago

#16203 assigned defect

[patch][ccla] DateTextBox: does not validate correctly when using a Hebrew date.

Reported by: barbossusus Owned by: dylan
Priority: undecided Milestone: 1.15
Component: DojoX Form Version: 1.7.3
Keywords: Cc: Adam Peller, hhelena, Douglas Hays
Blocked By: Blocking:

Description

Typing words, not numbers, in a DateTextBox? does not trigger the validation correctly because the regular expression provided by dojox.date.hebrew.locale is wrong.

From my investigation

_buildDateTimeRE : function(tokens, bundle, options, pattern){
....

line 372: s = '\\S+'; //in my opinion this should probably be replaced with s = '\\d+'
//because "\S" means "Find a non-whitespace character" (w3schools)

....
}

http://www.w3schools.com/jsref/jsref_obj_regexp.asp

Let me know if you need more details.

Attachments (3)

DateTextBoxTest.html (3.4 KB) - added by barbossusus 6 years ago.
Ticket_16203.png (62.5 KB) - added by barbossusus 6 years ago.
locale.js.patch (5.7 KB) - added by Adam Peller 6 years ago.
patch from Helena Halperin (IBM, CCLA)

Download all attachments as: .zip

Change History (18)

comment:1 Changed 6 years ago by bill

Component: GeneralDijit - Form
Owner: set to Douglas Hays
Summary: DateTextBox does not validate correctly when using a Hebrew date.DateTextBox: does not validate correctly when using a Hebrew date.

comment:2 Changed 6 years ago by Douglas Hays

Cc: Adam Peller hhelena added
Component: Dijit - FormDojox
Owner: Douglas Hays deleted
Status: newassigned

This is a possible problem with dojox/date/hewbrew/locale.js

comment:3 Changed 6 years ago by Adam Peller

could you please provide an example? Also, specify which calendar is used as well as which locale.

Last edited 6 years ago by Adam Peller (previous) (diff)

comment:4 in reply to:  3 ; Changed 6 years ago by barbossusus

Replying to peller:

could you please provide an example? Also, specify which calendar is used as well as which locale.

1) create a Hebrew calendar by setting datePackage argument in the constructor of dijit.form.DateTextBox? to dojox.date.hebrew
2) set <html lang="en">
3) var dojoConfig = {locale: "en", ...}
4) run this page - a DateTextBox? should be visible on the screen
5) type any number of letters (an invalid date)-> no error message is displayed

This behaviour is not consistent with neither the Gregorian, nor the Islamic calendar (if steps 2-6 are followed )

comment:5 in reply to:  4 Changed 6 years ago by Adam Peller

This works fine in our unit tests (in Hebrew, but I switched the locale to English and it worked as well) Please attach the full HTML page rather than a list of steps. You also may wish to check the Javascript console for errors.

Also, note that step #2 is not necessary, though given that it matches the dojoConfig, it should not be harmful either.

Changed 6 years ago by barbossusus

Attachment: DateTextBoxTest.html added

comment:6 Changed 6 years ago by barbossusus

Please use this file to observe the difference between the Hebrew and Gregorian DateTextBox? validation. I am also providing you with a screenshot. There are not console errors.

Changed 6 years ago by barbossusus

Attachment: Ticket_16203.png added

comment:7 Changed 6 years ago by bill

Cc: Douglas Hays added

CC'ing Doug since it sounds related to his partial regex matching code.

comment:8 Changed 6 years ago by Adam Peller

also need to check the locale.js module in hebrew against the others, as that code is still copied and needs to be updated with latest fixes

comment:9 Changed 6 years ago by Adam Peller

The use of
S+ must have been deliberate, because in the Hebrew locale, the years are represented by the Hebrew alphabet rather than numerals.

comment:10 Changed 6 years ago by barbossusus

Thanks for the prompt reply. Is this behaviour specific to the Hebrew calendar? The Islamic one behaves just like the Gregorian one.

Also, as a user I expect that the string I type (input) to be similar to the one produced by the control (output). So, if the control produces "5773-02-14"(only date strings represented using digits and dashes), the user is expected to introduce similar strings (learned from the control), without Hebrew alphabet. Otherwise this control would behave inconsistently.

comment:11 Changed 6 years ago by Adam Peller

Is this behaviour specific to the Hebrew calendar?

Yes. Hebrew letters, used to represent numbers, are specific to the Hebrew calendar in the Hebrew locale. There are alternate numeric symbols used for Arabic locales (in calendars and elsewhere) but they have yet to be implemented.

The case you cite is a Hebrew date represented "short" form in the English locale and does not use Hebrew letters. Somehow, that code must support formats for all locales.

Last edited 6 years ago by Adam Peller (previous) (diff)

Changed 6 years ago by Adam Peller

Attachment: locale.js.patch added

patch from Helena Halperin (IBM, CCLA)

comment:12 Changed 6 years ago by bill

Component: DojoxDojoX Form

comment:13 Changed 6 years ago by Adam Peller

Summary: DateTextBox: does not validate correctly when using a Hebrew date.[patch][ccla]DateTextBox: does not validate correctly when using a Hebrew date.

comment:14 Changed 3 years ago by dylan

Milestone: tbd1.12
Owner: set to dylan
Summary: [patch][ccla]DateTextBox: does not validate correctly when using a Hebrew date.[patch][ccla] DateTextBox: does not validate correctly when using a Hebrew date.

Not sure why this was never finally reviewed or landed?

comment:15 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.