Comments (6)
From @GoogleCodeExporter on April 18, 2015 5:51
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 [email protected]
on 28 Nov 2009 at 10:13
from datejs.
From @GoogleCodeExporter on April 18, 2015 5:51
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 [email protected]
on 30 Nov 2009 at 10:32
from datejs.
From @GoogleCodeExporter on April 18, 2015 5:51
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 [email protected]
on 30 Nov 2009 at 11:03
from datejs.
From @GoogleCodeExporter on April 18, 2015 5:51
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 [email protected]
on 30 Nov 2009 at 3:34
from datejs.
From @GoogleCodeExporter on April 18, 2015 5:51
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 [email protected]
on 2 Feb 2012 at 10:38
from datejs.
From @GoogleCodeExporter on April 18, 2015 5:51
fixed in my fork - https://github.com/abritinthebay/datejs/
Original comment by [email protected]
on 4 Oct 2013 at 9:26
from datejs.
Related Issues (20)
- Minimizing imports
- Represent milliseconds in a formatted Date
- Format JUST the time component HOT 1
- Custom format requests not being respected
- Is it easily used in webpack + typescript set up?
- Date.parse two different times returning same time...
- GetISOWeek return a wrong value
- Issue in parsing ISO string HOT 3
- The format specification for the toString method is not documented. HOT 1
- Incorrect LICENSE HOT 1
- MIT or Apache 2.0 HOT 2
- how to query for "last Saturday's" date ? HOT 1
- Query: Is this compatible with Jquery 3.3.1
- Release tag
- Adding Date.js Prevents jQuery Easings HOT 1
- Check if date is between two days of this week returns an error.
- Issue when adding Date.js with jQuery fadeIn() and animate()
- Countdown
- ago() and fromNow() is not working as expected
- not working on iOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datejs.