pingjiang / datejs

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

German Date Parsing (Fixed) #83

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parse any date string with english words eg. Sun, 09 Aug 2009 14:45:00 GMT
2. result will be null
3. that is bad.

What is the expected output? What do you see instead?
a correct date object! ha.

What version of the product are you using? On what operating system?
1.0 Alpha-1 date 2008-05-13 (mac os yeha)

Please provide any additional information below.
I fixed it this way:

Date.CultureInfo={name:"de-DE",englishName:"German 
(Germany)",nativeName:"Deutsch 
(Deutschland)",dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","
Freitag","Sam
stag"],abbreviatedDayNames:["So","Mo","Di","Mi","Do","Fr","Sa"],shortestDayNames
:["So","Mo","Di",
"Mi","Do","Fr","Sa"],firstLetterDayNames:["S","M","D","M","D","F","S"],monthName
s:["Januar","Februa
r","März","April","Mai","Juni","Juli","August","September","Oktober","November"
,"Dezember"],abbre
viatedMonthNames:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","N
ov","Dez"],amDesi
gnator:"",pmDesignator:"",firstDayOfWeek:1,twoDigitYearMax:2029,dateElementOrder
:"dmy",for
matPatterns:{shortDate:"dd.MM.yyyy",longDate:"dddd, d. MMMM 
yyyy",shortTime:"HH:mm",longTime:"HH:mm:ss",fullDateTime:"dddd, d. MMMM yyyy 
HH:mm:ss",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy
-MM-
dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"dd 
MMMM",yearMonth:"MMMM yyyy"},regexPatterns:{jan:/^jan(uar)?/i,feb:/^feb(ruar)?
/i,mar:/^mar|märz/i,apr:/^apr(il)?/i,may:/^may|mai/i,jun:/^jun(i)?/i,jul:/^jul(
i)?
/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct|okt(ober)?/i,nov:/^nov(em
ber)?
/i,dec:/^dec|dez(ember)?
/i,sun:/^sun|sonntag/i,mon:/^mon|montag/i,tue:/^tue|dienstag/i,wed:/^wed|mittwoc
h/i,thu:/^
thu|donnerstag/i,fri:/^fri|freitag/i,sat:/^sat|samstag/i,future:/^next/i,past:/^
last|past|prev(ious)
?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/
^yes(terday)?
/i,today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?
/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ut
e)?s?
/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,y
ear:/^y(ear)?s?
/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?
)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?
)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?
!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"},{name:"GMT",offset:"-
000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset
:"-
0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offse
t:"-
0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]};

Original issue reported on code.google.com by joinfi...@googlemail.com on 9 Aug 2009 at 4:07

GoogleCodeExporter commented 9 years ago
The same issue happens with Spanish translation, so if I write 
Date.parse('sunday') delivers null, but if I write Date.parse('domingo') it 
works

Regex patterns should not be translated, since it makes coding more difficult.

Original comment by cor...@aldomx.com on 13 Dec 2010 at 6:14