superobin / datejs Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/datejs
Automatically exported from code.google.com/p/datejs
I commented here - http://code.google.com/p/datejs/wiki/FormatSpecifiers - but
realized that
may not have been the right place.
I'm trying to parseExact a date string like "yyyy-MM-ddTHH:mm:ss.000-05:00" but
the latter part
(-05:00) breaks if it's a different time zone (-06:00) is present. I've tried
using "P" (noted above) but
no joy. I'm using trunk. I can't change the format... google calendar RSS. :)
I've also tried using just "c", but the presence of milliseconds in the string
breaks it.
Anything I can try?
Original issue reported on code.google.com by [email protected]
on 24 May 2008 at 3:30
For example, the year "0001" gets formatted as "1".
Attached is a patch to core.js which fixes this problem
Original issue reported on code.google.com by [email protected]
on 4 Mar 2008 at 12:29
Attachments:
Within Firebug, "Break on All Errors" must be enabled.
Within Firebug try the following...
Date.parse('asdf')
Firebug jumps into the debugger and returns this.message and 's' as undefined.
Line 11:
Exception: function(s) {
this.message = "Parse error at '" + s.substring(0,10) + " ...'";
}
[FIXED] Returned null within Parser.finish if the Array length is 0.
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 2:03
What steps will reproduce the problem?
1. Parse a date like 'jan 2008' or '1 2008'
2.
3.
What is the expected output? What do you see instead?
The expected output would be january 1, 2008. the actual result is january
27 2008. The day number is incorrect, it uses the day number of the actual
date.
What version of the product are you using? On what operating system?
1.0 alpha 1, 24th March 2008
Please provide any additional information below.
All other months return the correct result. It is just January that returns
the current day number rather than the 1st. The same error occurred for any
year I tried.
Original issue reported on code.google.com by [email protected]
on 27 Mar 2008 at 9:00
Date.parse("yesterday week").equals(Date.parse("next week")); //
[PASS]which is not good
The following should pass...
Date.parse("yesterday week").equals(Date.parse("next week").add(-1).day());
// currently fails
This is a bit of known issue when combining Relative dates ("tomorrow")
with date math ("+week"). One hand is not talking to the other.
A fix is planned and should be available in the next release (Beta 1) of
the Parser.
Original issue reported on code.google.com by geoff%[email protected]
on 27 Nov 2007 at 10:36
What steps will reproduce the problem?
1. Type "monday +2week"
What is the expected output? What do you see instead?
Expected output: ideally, two weeks from the following monday (although
given a previous issue I've raised, even "monday" or "+2week" would be
*more* expected; "+2 days" is just bizarre.
What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:35
Seems to be a problem in .parseExact() somewhere, or maybe it's in
Parser.finishExact. For example...
// returns null
Date.parseExact("November 2007", ["MMMM d", "MMMM yyyy"]);
// Switch the format order, and a valid date is returned
Date.parseExact("November 2007", ["MMMM yyyy", "MMMM d"]);
Original issue reported on code.google.com by geoff%[email protected]
on 26 Nov 2007 at 6:10
Hello,
I just wanted to point out that this library would be very useful if it
returned back unix timestamps and other date formats compatible with other
systems.
Thank you.
Original issue reported on code.google.com by [email protected]
on 18 Feb 2008 at 8:33
Iterating from 1 st of january with monday as start of week will
give buggy results (0, 52, 1, 2, 3) and weeks will be one off from
the ISO version.
dateiterator = new Date(2008,01-1,01);
end = new Date(2008,05-1,31);
while (dateiterator < end)
{
alert(dateiterator + '\n' + dateiterator.getWeekOfYear());
dateiterator.moveToDayOfWeek(1);
i++;
}
Definition: A week is identified by its number in a given year. A week
begins with a Monday, and the first week of a year is the one which
includes the first Thursday, or equivalently the one which includes January 4.
Original issue reported on code.google.com by [email protected]
on 27 Feb 2008 at 9:19
"2 week t" returns "+2week"; "2 week" returns "today"
What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:39
The parser does not accept 3 (or more) character math numbers.
Example
Date.parse('+100'); // fail
Original issue reported on code.google.com by geoff%[email protected]
on 29 Nov 2007 at 12:22
Provide base CultureInfo file for all cultures.
At least 150+ individual cultures will be provided.
Some of the CultureInfo.regexPatterns section will have to be customized by
hand for each culture.
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 2:04
What steps will reproduce the problem?
1. Try to parse 'Dez' (december), or 'Okt' (October) with german globalization.
What is the expected output? What do you see instead?
I couldn't get some month to parse.
What version of the product are you using? On what operating system?
Using latest version of trunk.
See attached test cases.
Original issue reported on code.google.com by [email protected]
on 4 Apr 2008 at 9:43
Attachments:
What steps will reproduce the problem?
1. Type "december 9 at 9am"
What is the expected output? What do you see instead?
You will see: Saturday, December 01, 2007 9:00:00 AM
Should be: Sunday, December 09, 2007 9:00:00 AM
What version of the product are you using? On what operating system?
Alpha 1. Firefox
Please provide any additional information below.
Otherwise -- great script! Thanks
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 2:19
Giving tomorrow -1 day returns yesterday instead of today.
Original issue reported on code.google.com by geoff%[email protected]
on 19 Apr 2008 at 7:24
Safari 2's implementation of Date#setDate uses a signed byte integer which
means large values will get 'rolled over' and return an incorrect value
unless the add/subtracts are called in increments. The following link
details this bug which affects the addition methods that use setDate. This
issue does not affect Safari 3.
http://brianary.blogspot.com/2006/03/safari-date-bug.html
I tested using the version installed at http://www.datejs.com/
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 2:59
Date.parse('12 pm') returns 24 to the hour validator and fails.
It should return 12 (noon) of today.
Original issue reported on code.google.com by geoff%[email protected]
on 28 Nov 2007 at 2:00
Specifying "next [some day]" or "last [some day]" behaves as expected, but
specifying "[some day]" on it's own gives you the *nearest* [some day], so
the behaviour will vary depending on the day of the week. (Typing "monday"
today gives me "last monday", but typing "monday" on Friday will give me
"next monday".)
What is the expected output? What do you see instead?
Personally, I'd expect it to always default to "next [some day]", but that
relies on local convention -- for other people "nearest [some day]" or"last
[some day]" may be the expected behaviour. (I trust you realise that a
*huge* subset of this problem area requires strong AI? :)
What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:45
Date.js doesn't parse time with 'tomorrow', 'yesterday'.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2008 at 1:26
What steps will reproduce the problem?
1. Use the French localization
2. Various shorthands do not work, some translations are not done.
3.
What is the expected output? What do you see instead?
I expect to get the full date form of the shorthand entered, I do not get
anything.
What version of the product are you using? On what operating system?
the latest version, operating system independent.
Please provide any additional information below.
The attached file resolves the issue.
Original issue reported on code.google.com by [email protected]
on 8 Sep 2008 at 2:28
Attachments:
I'm parsing dates from "yyyy-MM-ddTHH:mm:ss-05:00" format and then
toString()'ing them.
I'm being told that some folks were seeing strange dates as a result, so I
fired up Parallels and
MSIE6 and sure enough, they we weird. Hours off.
I checked the system time and *it* was way off. Set it. Quit and re-opened MSIE
and all was well.
So I can envision a way to say "hey, buddy, your clock's off, so these dates
might be too," but
what's bugging me is why is it that a specific date being read in and then
printed out is affected
by the system's time settings?
Is there a way to override this? Maybe some kind of Date.setBaseTime() or
Date.setTimeZone()?
You may or may not be able to see this in action here...
http://www.redeemerbaptist.org/
...using a WordPress plug-in I'm attempting to make here...
http://code.google.com/p/wp-gcal-rss/
Whining aside, thanks for a great tool!
Original issue reported on code.google.com by [email protected]
on 4 Jun 2008 at 1:20
What steps will reproduce the problem?
1. Type "saturday"
What is the expected output? What do you see instead?
Expected: A similar result to "monday", "friday", etc.
What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:40
File date-en-US.js version 1.0 alpha 1.
Parsing a date string of "12 am" returns 12pm.
Parsing a date string of "12 pm" results in an error.
Original issue reported on code.google.com by [email protected]
on 7 Sep 2008 at 1:05
What steps will reproduce the problem?
var d = Date.pase("13:00am");
// d should be null, but is 1:00pm.
What is the expected output? What do you see instead?
d should be 1:00pm.
What version of the product are you using? On what operating system?
Using date-en-AU.js from SVN (r130) in Firefox 2.0.0.11 on Mac OS X 10.5.1
Please provide any additional information below.
Original issue reported on code.google.com by craig.e.anderson
on 24 Jan 2008 at 6:32
In file date-en-US.js, version 1.0 alpha 1.
I see that formatPatterns was created a a sub-array of CultureInfo, and
each pattern had the "pattern" suffix removed. References to those patterns
were updated to CultureInfo.formatPatters however the "pattern" suffixes
remain.
Original issue reported on code.google.com by [email protected]
on 7 Sep 2008 at 1:00
More of a feature request than a bug, but quite an important one I feel.
It's important for us to be able to distinguish between a situation where
only a date is entered, and no precise time (eg 'Tuesday'), and a situation
where both a date and a precise time is entered ('Tuesday 12:00am').
While we can just check for 12:00am and treat it at 'time not entered',
sometimes our users do enter this as a precise time for an event.
Original issue reported on code.google.com by [email protected]
on 14 Feb 2008 at 5:50
If you parse just a valid day name (friday, monday, etc), the parser always
returns today's date.
Date.parse('friday') // returns today
Date.parse('monday') // returns today
Parsing month names works as expected.
Date.parse('march') // returns 1st of March
Original issue reported on code.google.com by geoff%[email protected]
on 13 Nov 2007 at 8:54
I suggest putting generalDelimiter into Date.CultureInfo.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2008 at 1:29
I've made some additions to the Russian translation. Now date.js can parse
values like 'now', '+2 years', etc. in Russian.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2008 at 1:32
Attachments:
Summary:
Prior to datejs, Date.parse("Tue Nov 20 08:00:00 UTC 2007") was correctly
parsed. The new Date.parse method does not parse it correctly.
I'm guess we need to add a format "ddd MMM dd HH:mm:ss zzz YYYY", or
thereabouts.
Original issue reported on code.google.com by [email protected]
on 18 Dec 2007 at 9:06
What steps will reproduce the problem?
1. Run the following in Firebug, <code>Date.parse('asdf')</code>
2. Firebug jumps into debugger and shows variable 's' as undefined.
A return value of Null is expected when the supplied string cannot be
parsed into a Date object.
Test available online at http://www.datejs.com/test/core/. Must be using
FireFox.
Error happens on any parse failure.
Example
Date.parse()
Date.parse('')
Date.parse('asdf')
Date.parse(null)
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 2:01
Example: Date.parse('31')
If month does not have 31 days, the Parser is correcting to the last day of
the month. A RangeError should be thrown.
See /test/partial/.
The core throws a RangeError.
Example:
try {
new Date(2007, 10, 5).set( { day: 31 } )
}
catch(ex) {
console.log(ex)
}
[FIXED] Moved Type checking and RangeError checks into validate*() functions.
Reworked .add() and .set() functions. There were problems with '0' being
dealt with as a null value.
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 2:02
What steps will reproduce the problem?
1. Create a new TimePeriod object for two dates
2. var foo = TimePeriod(Date.today(), Date.today());
What is the expected output? What do you see instead?
expected: foo should be an object
actual: the error d1.getDaysInMonth() is not a function
What version of the product are you using? On what operating system?
Latest SVN nightly (as of May 7th, 2008)
Please provide any additional information below.
The problem is that lines 245 and 251 of time.js are using:
d1.getDaysInMonth()
However, getDaysInMonth is a static function, not an instance method.
Changing the line:
d1.getDaysInMonth() to
Date.getDaysInMonth(d1.getYear(), d1.getMonth())
fixes the problem
Original issue reported on code.google.com by [email protected]
on 7 May 2008 at 5:04
What steps will reproduce the problem?
1. Open your homepage in IE7 and Firefox2 on a thur, fri or sat
2. Type 'wednesday' in Mad Skillz.. demo box
3. IE7 shows May 14, Firefox show May 7.
Same issue for 'today', 'sun.. sat', 'last ...', etc.
Safari works like Firefox. I don't know about IE6 yet.
What is the expected output? What do you see instead?
The same date on all browsers. Different dates depending on the browser.
What version of the product are you using? On what operating system?
* Version: 1.0 Alpha-1
* Build Date: 13-Nov-2007
Original issue reported on code.google.com by [email protected]
on 11 May 2008 at 2:58
What steps will reproduce the problem?
var d1 = Date.parse("0:00am");
var d2 = Date.parse("0:00pm");
if(d1.getTime() == d2.getTime()) {
alert("This shouldn't be");
}
What is the expected output? What do you see instead?
Either:
* 0:00pm and 0:00am are rejected, or
* 0:00am == 12:00am and 0:00pm == 12:00pm.
What version of the product are you using? On what operating system?
Using date-en-AU.js from SVN (r130) in Firefox 2.0.0.11 on Mac OS X 10.5.1
Please provide any additional information below.
I'm happy to be corrected on what 0:00am and 0:00pm mean, but it struck me as
odd that these
times were accepted.
Original issue reported on code.google.com by craig.e.anderson
on 24 Jan 2008 at 6:07
Would love to be able to use Quarters (Q1, Q2, Q3, Q4)
Original issue reported on code.google.com by [email protected]
on 29 Sep 2008 at 9:37
What steps will reproduce the problem?
1. Open console window
2 new Date(2007,11,16,0,51,53).toString("MMMM dd, yyyy - hh:mm tt")
What is the expected output? What do you see instead?
I see "December 16, 2007 - 00:51 AM"
I expect "December 16, 2007 - 12:51 AM"
What version of the product are you using? On what operating system?
Alpha1. All browsers produce the same.
Please provide any additional information below.
To fix this, go to line core-debug.js line 604 - 602
Change it to
case "hh":
return p(self.getHours() < 13 ? (self.getHours() == 0 ? 12 : self.getHours()) :
(self.getHours() - 12));
case "h":
return self.getHours() < 13 ? (self.getHours() == 0 ? 12 : self.getHours()) : (self.getHours()
- 12);
I've attached a fixed version of latest_alpha1. It includes a unit test to
diagnose and fix the
problem.
Thanks
Original issue reported on code.google.com by [email protected]
on 22 Dec 2007 at 12:59
Attachments:
I think there is a logic error in the parser with two digit years.
The CultureInfo.twoDigitYearMax will return a four digit year. The year
Translator will always return true.
year: function(s) {
return function() {
var n = Number(s);
this.year = (( s.length > 2 ) ? n :
(n + ( ( n < Date.CultureInfo.twoDigitYearMax ) ? 2000 : 1900 )));
};
},
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 2:00
Could there please be added support for PHP's strftime syntax.
http://php.net/strftime
Original issue reported on code.google.com by [email protected]
on 20 Mar 2008 at 12:30
What steps will reproduce the problem?
date.parse( "3pm tomorrow" ) // Done on 9/12/2008.
What is the expected output? What do you see instead?
Expected: Saturday, September 13, 2008 03:00:00 PM
Actual: Saturday, September 13, 2008 12:00:00 AM
In other words, it's not bothering with the time portion of the english phrase.
What version of the product are you using? On what operating system?
FF3 / Windows XP.
Original issue reported on code.google.com by [email protected]
on 12 Sep 2008 at 2:57
What steps will reproduce the problem?
1. Type in Date.today().getTimezone()
2. Returns null instead of "PST"
What is the expected output? What do you see instead?
It should say "PST" for my specific timezone. It always returns null though
with whatever date I give it.
What version of the product are you using? On what operating system?
Alpha-1. Using Firefox 2.0.0.11 on Mac OS X Leopard. Same problem in Safari
3.0.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2007 at 5:25
Date.parse("2008/03/11 5:17:00 -0800")
Tue Mar 11 2008 06:17:00 GMT-0700 (PDT) _orient=1 _is=false
Why does it return back 6:17 AM?
Original issue reported on code.google.com by eggie5
on 11 Mar 2008 at 10:46
What steps will reproduce the problem?
1. Type in 05/11/07 to the test textbox
2.
3.
What is the expected output? What do you see instead?
In the USA you would expect to see this resolved as 11th May (which is what
is displayed) but in Europe you would expect to see 5th November.
If you type in 23/11/07 this is correctly interpreted as 23rd November - so
where there is no ambiguity - there is no problem.
Would it be possible to use system information from the browser to correct
this?
What version of the product are you using? On what operating system?
Current test screen running in up to date FireFox
Please provide any additional information below.
Otherwise it all looks brilliant
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 4:21
What steps will reproduce the problem?
1. set timezone to middle east
2. Date.parse( "02/19/2008 6:00 PM GMT" )
3. Date.toString( "MM/dd/yyyy HH:mm:ss tt" ) returns "02/01/2008 8:00 PM"
What is the expected output? What do you see instead?
"02/19/2008 8:00 PM"
What version of the product are you using? On what operating system?
version: 1.0 Alpha-1, Windows US
Original issue reported on code.google.com by [email protected]
on 13 Feb 2008 at 4:54
What steps will reproduce the problem?
1. Create a new date var d = new Date().today();
2. alert(d.toShortTimeString())
What is the expected output? What do you see instead?
Expected: 6/19/2017
See: Mon Jun 19 2017 00:00:00 GMT+0100 (GMT Daylight Time)
What version of the product are you using? On what operating system?
Alpha1
Please provide any additional information below.
All these methods do not work because they have the formatPatterns.xxx
option spelt incorrectly. Example
return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);
should be
return this.toString(Date.CultureInfo.formatPatterns.shortDate);
Original issue reported on code.google.com by [email protected]
on 20 Apr 2008 at 9:01
What steps will reproduce the problem?
1. type "day after tomorrow"
What is the expected output? What do you see instead?
Expect equivalent to "+2 days"; get equivalent of "+1 day"
What version of the product are you using? On what operating system?
Firefox 2, OS X 10.5.1
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:33
*******************************************************
This issue originated as post in the Datejs forums. See
http://tinyurl.com/2sznas
The issue has been moved here to track it's status.
*******************************************************
Using version 1.0 Alpha-1 the following code:
alert( new Date().isDST() );
gives the following error in the Firebug console:
this.toString().match(/(E|C|M|P)(S|D)T/) has no properties
The above code seems to assume that Date.toString() returns a string
that includes a time zone, and that it matches the regular
expression.
Looking at that particular function:
Date.prototype.isDST = function () {
console.log('isDST');
/* TODO: not sure if this is portable ... get from
Date.CultureInfo? */
return this.toString().match(/(E|C|M|P)(S|D)T/)[2] == "D";
};
The value returned by match(...) should be tested to see if a second
element exists before attempting the evaluation. It also seems to be
a very weak test of whether or not daylight saving is in force (or at
least whether the system executing the code thinks daylight saving is
being observed).
The notes in the code show doubt about the usefulness of the function
- does the CultureInfo section need to define every time zone in the
world, and identify which ones are DST and which aren't?
There is a useful list of time zone abbreviations here:
<URL; http://www.worldtimezone.com/wtz-names/timezonenames.html >
but I have no idea how authoritative they are - as far as I know,
there is no standard for them.
--
Rob
Original issue reported on code.google.com by geoff%[email protected]
on 19 Dec 2007 at 7:56
Date.parseExact('July 2004', 'MMMM yyyy') // [FAIL]
Improperly returns null.
Same problem when using four character day specifier ('dddd') in .parseExact().
Original issue reported on code.google.com by geoff%[email protected]
on 12 Nov 2007 at 12:46
LOVE YOUR WORK.
Date.parse('next wed at 4PM') returns:
Wed Jan 23 2008 04:00:00 GMT+1100 (EST)
The work around is:
Date.parse('next wed at 16PM')
Incidently Date.parse('next wed at 16AM'): (NOTE AM) returns
Wed Jan 23 2008 16:00:00 GMT+1100 (EST)
All tests were run using [date-en-AU.js]
Original issue reported on code.google.com by [email protected]
on 17 Jan 2008 at 9:13
What steps will reproduce the problem?
1. type "+2 weeks"
What is the expected output? What do you see instead?
Expect the date two weeks from now; get an error instead. ("+2 years" works.)
Original issue reported on code.google.com by [email protected]
on 28 Nov 2007 at 8:31
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.