Opened 11 years ago

Closed 11 years ago

#6915 closed defect (fixed)

dojo.date.locale.format failed when patterns begins qith literals

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.2
Component: Date Version: 1.1.0
Keywords: dojo.date.local.format Cc:
Blocked By: Blocking:

Description

Hello.

We noticed that when using a pattern which begin with literal the function dojo.date.local.format() failed.

For example the following code works, because of the leading space :

dojo.date.locale.format(new Date(), {selector:"date", datePattern:" 'Week' w, MMMM, yy"});

and the following code failed :

dojo.date.locale.format(new Date(), {selector:"date", datePattern:"'Week' w, MMMM, yy"});

To avoid this, just correct the _processPattern() method :

replace the 'literal' variable initialization from :

var literal = false

to :

var literal = pattern.match(/^'/g) != null;

which test if the pattern begins or not with a literal.

thank you !

Matthieu et Damien.

Change History (2)

comment:1 Changed 11 years ago by Adam Peller

Milestone: 1.2

comment:2 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: newclosed

fixed by [13980]: Handle patterns which start with a literal at char 0. Fixes #6915 Merci, Matthieu et Damien!

Note: See TracTickets for help on using tickets.