snehalmasne / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

CultureInfo: Some Month Names of German and French Translations Do Not Deliver Correct Result #74

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use either the de-DE or the fr-FR translation.
2. Try the German month names "Oktober" or "Dezember" or any of the French 
month names.
3. The parse function will return the current month.

What is the expected output? What do you see instead?
The specified month.

What version of the product are you using? On what operating system?
Latest downloadable version on WXP SP3.

Please provide any additional information below.

---

Original issue reported on code.google.com by dietmar....@hisec.at on 15 May 2009 at 8:03

GoogleCodeExporter commented 9 years ago
I also got this behaviour. And investigated a little bit.

It only occurs when abbreviated month names differ from english (e.g. okt - oct 
and
dez - dec). Can you confirm this?

The problem lies in the parser. Line 520 is a method that returns the month 
number,
which is done by checking for a 3 letter abbreviated month name in the 
cultureinfo.

NOTE: this might give rise to a problem when names are abbreviated in other 
than 3
letters

line 713 defines some months in english (don't know what this line does, but it 
is
relevant). Furthermore, the keys of the regexpatterns in cultureinfo are 
english.

I resolved this bug by doing the following
- changed regexPattern keys to the abbreviated month name keys
- changed line 713 to the following:

g.MMM=g.MMMM=_.cache(_.process(g.ctoken(Date.CultureInfo.abbreviatedMonthNames.j
oin('
')),t.month));

which effectively builds the string from the cultureinfo

NOTE: this is also a problem with day names

Original comment by rikkertk...@gmail.com on 28 Nov 2009 at 10:13

GoogleCodeExporter commented 9 years ago
Dear rikkertkoppes,

Thanks for your investigation! Unfortunately I am no JS expert, which leaves me 
a 
bit helpless.

I tried your change, but it does not make any difference, at least not in my 
case. I 
still get the current month when I try e.g. "Dez" for December. And if pattern 
and 
month name contain accented characters ("März") the result is empty thereby 
signalling an error.

What is your environment? I am using IIS 6.0 at the server and IE 7 at the 
workstation. Maybe this is relevant as well.

Best regards,
Dietmar.

Original comment by dietmar....@hisec.at on 30 Nov 2009 at 10:32

GoogleCodeExporter commented 9 years ago
Did you recompile? I doubt so, since you say you are not a js expert.

Which files did you change? If you changed things in the src directory, it 
won't work
instantly. You need to recompile your files.

When you don't know how to do that, you can also adjust your built file in the 
build
directory, it is a bit more messy, but nevermind

- open your language version build file in a text editor, code should look 
really
crammed up.
- locate your cultureInfo and change it there (crammed up at the top);
- locate the following part:

g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep 
oct nov
dec"),t.month));

and change it to

g.MMM=g.MMMM=_.cache(_.process(g.ctoken(Date.CultureInfo.abbreviatedMonthNames.j
oin('
')),t.month));

I checked the german file, this part is in line 99
NOTE: there is a space in the join function (join(' '))

Original comment by rikkertk...@gmail.com on 30 Nov 2009 at 11:03

GoogleCodeExporter commented 9 years ago
You are right, I do not know how to recompile the files. (I even did not know 
that 
this is possible...) So I tried the same as in the test directory, where the 
inclusion of the individual language specific build file is replaced by the 
following sequence:
    <script type='text/javascript' src='../src/globalization/de-DE.js'></script>
    <script type='text/javascript' src='../src/core-debug.js'></script>
    <script type='text/javascript' src='../src/sugarpak-debug.js'></script>
    <script type='text/javascript' src='../src/parser-debug.js'></script>
    <script type='text/javascript' src='../src/time-debug.js'></script>

I also tried to edit the build file and include this one, but the result was 
even 
worse, as no month name whatsoever is parsed any more...

Very disappointing...  :-((

Original comment by dietmar....@hisec.at on 30 Nov 2009 at 3:34

GoogleCodeExporter commented 9 years ago
This issue is present in Spanish language also, at least in es-MX. I think it's 
priority should be set to high since this pretty much makes the library 
unusable for the affected languages.

Original comment by juan.pab...@gmail.com on 2 Feb 2012 at 10:38

GoogleCodeExporter commented 9 years ago
fixed in my fork - https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 4 Oct 2013 at 9:26