Hi,
when using a calendar (input with a bind to a date), is there a way to control the interpretation of the input ? For what I've seen: - 1-31 will be the nth of the current month - 32-99 is n day after the first of the current month - x0y is the yth day of xth month of the current year - Then it's a little random 511950 will give 05/01/2050 but 151950 will give 01/05/2050 From what i gathered, the control tries to interpret some symbols (any symbol, this includes digits) as separators. So for example, 151950 is 1/1/50 instead of 1/5/1950 and because it's more than 50 years, the '50' is translated as 2050 instead of 1950. This is pretty confusing for users, specially when they explicitly put the year with 4 digits and not only 2. So i'm looking for a way to be a lot stricter. For instance only allowing the dd/mm/yyyy format (with explicit separators). The rest would render the value invalid instead of trying to translate it in something it is not. Is there a way to do that ? We're using Orbeon 3.8, and our forms are mostly in french, so dd/mm order. Thanks -- Florian -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Florian,
I have commented and answered your SO question: http://stackoverflow.com/questions/18574514/orbeon-calendar-behavior/18582283#18582283 -Erik On Mon, Sep 2, 2013 at 6:14 AM, Florian LACOSTE <[hidden email]> wrote: > Hi, > > when using a calendar (input with a bind to a date), is there a way to > control the interpretation of the input ? > > For what I've seen: > > - 1-31 will be the nth of the current month > - 32-99 is n day after the first of the current month > - x0y is the yth day of xth month of the current year > - Then it's a little random > > 511950 will give 05/01/2050 > but 151950 will give 01/05/2050 > > From what i gathered, the control tries to interpret some symbols (any > symbol, this includes digits) as separators. > > So for example, 151950 is 1/1/50 instead of 1/5/1950 and because it's more > than 50 years, the '50' is translated as 2050 instead of 1950. > > This is pretty confusing for users, specially when they explicitly put the > year with 4 digits and not only 2. > > So i'm looking for a way to be a lot stricter. For instance only allowing > the dd/mm/yyyy format (with explicit separators). The rest would render the > value invalid instead of trying to translate it in something it is not. > > Is there a way to do that ? > > > We're using Orbeon 3.8, and our forms are mostly in french, so dd/mm order. > > Thanks > > -- > Florian > > -- > You received this message because you are subscribed to the Google Groups > "Orbeon Forms" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > To post to this group, send email to [hidden email]. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
For information, what's bringing the most weird behavior is that all the regexes in the method _dateParsePatterns (https://github.com/orbeon/orbeon-forms/blob/223b6a91087272c65509afcb1860d224fce5acda/src/resources-packaged/ops/javascript/xforms.js#L696) use '.' as separators.
Replacing them by a finite list (ex: [\.\-\s\/]) makes a much more restrictive interpretation. Also there was a little bug there in my version, eu/us interpretations were switched in one case. |
Administrator
|
Florian,
Allowing any character as separators is a bug. I have committed a fix which uses a list of separators as you have suggested: https://github.com/orbeon/orbeon-forms/commit/cbe7f9aa5496d31973a44c845681a237f79f922c BTW although it's not wrong, it's not necessary to escape "." and "/" in character classes: http://www.regular-expressions.info/charclass.html So I just wrote: [./\-\s] and I think you can even write: [-./\s] I also fixed this bug as I was at it: https://github.com/orbeon/orbeon-forms/issues/1154 Thanks for the feedback! -Erik On Thu, Sep 5, 2013 at 7:54 AM, F_L <[hidden email]> wrote: > For information, what's bringing the most weird behavior is that all the > regexes in the method _dateParsePatterns > (https://github.com/orbeon/orbeon-forms/blob/223b6a91087272c65509afcb1860d224fce5acda/src/resources-packaged/ops/javascript/xforms.js#L696) > use '.' as separators. > > Replacing them by a finite list (ex: [\.\-\s\/]) makes a much more > restrictive interpretation. > > > Also there was a little bug there in my version, eu/us interpretations were > switched in one case. > > -- > View this message in context: http://discuss.orbeon.com/Calendar-input-behavior-tp4657237p4657272.html > Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com. > > -- > You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. > To post to this group, send email to [hidden email]. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. |
Free forum by Nabble | Edit this page |