Comments (23)
This is of course no Defect, but an Enhancement.
Original comment by [email protected]
on 21 Jul 2007 at 4:12
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from base2.
I prefer my parser as it seems a bit simpler. It is only a small change to make
it UTC.
Original comment by [email protected]
on 23 Jul 2007 at 9:01
from base2.
Your code is indeed more elegant. But I reckon, because date/time stuff is not
really regular, code shouldn't
be either. But hey, it's your library. But before all, it should be correct.
Another difference in behaviour (very minor):
"T00:00:00:5678" will result in a date.getSeconds()==5 and it should be 0 (5678
needs to be rounded to 568,
because it are milliseconds, and not hectomicroseconds).
And I can port my testcases...
Shall I fix those bugs in you code?
Original comment by [email protected]
on 23 Jul 2007 at 9:20
from base2.
Fix my code and upload your test cases to svn/trunk/test/.
hectomicroseconds!? :-P
I'm thinking of creating a separate namespace for the Array2/Date2/String2 etc.
e.g.
base2.JavaScript.bind(window);
base2.JavaScript.bind(Array);
A bit like base2.DOM.bind(); but fixes native JavaScript objects. What do you
think?
Original comment by [email protected]
on 23 Jul 2007 at 9:49
from base2.
I like it. base2.JavaScript.bind(Array); this will enhance the native Array
with our Array2 extra's, I assume? What
does base2.JavaScript.bind(window); actually do? And I take Date2 is still
usable, if one doesn't want to bind.
And of course:
base2.JavaScript.bind(window,Array,Date);
Original comment by [email protected]
on 23 Jul 2007 at 10:03
from base2.
base2.JavaScript.bind(window) will upgrade all of the native objects to base2
objects. Static methods would be copied across and the prototypes would be
augmented.
It is equivalent to base2.DOM.bind(document).
And yes, Array2, Date2, etc would still be usable much like the base2.DOM
library
methods are still usable. I want base2 to be unobtrusive. But I want to be able
to
sprinkle the sugar easily. :-)
Original comment by [email protected]
on 23 Jul 2007 at 12:34
from base2.
The candy man can!
We might have gotten our self a mascotte or logo ;-)
Original comment by [email protected]
on 23 Jul 2007 at 3:48
from base2.
OK. I've removed my Date2, fixed JavaScript/Date2 and created some unit tests.
Bugfixes:
Date2.toISOString()
- "date = Date(date)" casts to date's string representation, so removed
- suffix "Z" added
- trimmed 0 timeparts
Date2.parse:
- now returns value in ms
- when no match, Date.parse is used
- Milliseconds are now rounded to 3 digits
- Timezones are now supported. Without timezone info, local timezone is
respected
- Changed internal type from Date2 to Date
- Fixed parsing a time only (break => continue)
- Fixed asserting
About the tester. I don't think tester.js is the ultimate solution, but I
didn't want to wait and think longer for some unit tests. If you
have some better idea's, your welcome to improve it.
Are the fixes OK?
Original comment by [email protected]
on 23 Jul 2007 at 3:52
- Changed state: Started
from base2.
Have you checked in the changes to the Date2 object yet? I just updated and the
only
changes were in /test/.
Original comment by [email protected]
on 23 Jul 2007 at 4:17
from base2.
Oops. If I'm not careful, this will become a habit ;-)
Original comment by [email protected]
on 23 Jul 2007 at 4:24
from base2.
I noticed JavaScript/Date2.js has not yet been added to package.xml. I've
worked my way around this in the
tester.
Original comment by [email protected]
on 23 Jul 2007 at 4:27
from base2.
Date.parse() should return a Date object right? In your changes we now have
return date.valueOf();
Is that right? date.valueOf() returns a number...
PS/ I'm starting to like the test harness. Much better than my crappy pages.
Original comment by [email protected]
on 23 Jul 2007 at 4:53
from base2.
Date.parse actually returns a number (ms since epoch). I've corrected that:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Object
s:Date:parse
But we are both right. In the es4 proposal, it returns a Date. I've asked for
clarification on the es4-list.
Also: current Date.parse returns NaN when the string is not parsible.
What do we do, when js2 is incompatible with the current js?
We better wait for the es4-list answer.
Original comment by [email protected]
on 23 Jul 2007 at 5:25
from base2.
Ah, a test harness. Super! Also better than my crappy runner, I hope...
Original comment by [email protected]
on 23 Jul 2007 at 5:26
from base2.
But do you like this kind of tests?
I'm planning to write some more tests. Any comments on the tests themselves
would be welcome.
Original comment by [email protected]
on 23 Jul 2007 at 5:28
from base2.
> What do we do, when js2 is incompatible with the current js?
> We better wait for the es4-list answer.
Mmm. Tricky. JS2 is far away. What's the point in being out of synch with
real-world
JavaScript. But we'll wait.
> But do you like this kind of tests?
The tests are great. Please write more. :-)
Original comment by [email protected]
on 23 Jul 2007 at 5:43
from base2.
Brendan Eich himself answered Date.parse returning a Date was a mistake.
He didn't have an answer on the parse-issue, though. So that point stays open.
Original comment by [email protected]
on 23 Jul 2007 at 8:52
from base2.
Almost done. Two questions:
- ISO parse overflow: should return NaN instead of the SyntaxError now thrown?
What
do you think: if(console&&console.log) logging?
- I can't think of a sensible way to combine defaultDate and Date.parse (legacy
parse). Can you?
Original comment by [email protected]
on 31 Jul 2007 at 2:28
from base2.
> ISO parse overflow: should return NaN instead of the SyntaxError now thrown?
Agreed.
> I can't think of a sensible way to combine defaultDate and Date.parse (legacy
parse). Can you?
No. We should just ignore it for non-ISO dates.
Original comment by [email protected]
on 10 Aug 2007 at 4:16
from base2.
Just checked in a changes to Date2. Date2.parse now returns "new Date(NaN)"
whenever
the date cannot be parsed.
Original comment by [email protected]
on 10 Aug 2007 at 9:55
- Changed state: Fixed
from base2.
I thought Date.parse always returns a number... Now it returns a number, except
if one of the date-parts
overflow.
Original comment by [email protected]
on 11 Aug 2007 at 12:33
from base2.
My mistake. I'll change it to NaN.
Original comment by [email protected]
on 11 Aug 2007 at 7:21
- Changed state: Re-open
from base2.
Original comment by [email protected]
on 5 Dec 2007 at 4:48
- Changed state: Fixed
from base2.
Related Issues (20)
- Please add Array2.make HOT 2
- 'Unspecified error' when loading a page via iframe in IE8.
- Function.bind() defined in Firefox 4 conflicts with Base2's own bind()s. HOT 1
- base62 encoding shrinked script fails with 3.1 but works with 3.0 HOT 3
- Contact to the owner of the project? HOT 1
- DOMContentLoaded does not fire in Safari 3.0.4 (and possibly other versions) HOT 1
- IE throws "Unspecified Error" when calling some methods or accessing some properties of elements not attached to a document
- base2.jsb.eventDispatcher fails to dispatch (delegated?) events under IE9
- Listeners for (before)?(cut|copy|paste) events are not executed in IE7-9 HOT 1
- Patch for /trunk/src/apps/MiniWeb/Client.js
- Patch for /trunk/src/apps/MiniWeb/Client.js
- document not geting extended.
- getting opacity in getComputedPropertyValue of ViewCSS returns empty string on element without opacity set
- Eclipse "Syntax error on token "new", ArrayLiteralHeader expected after this token", l. 19 of v1.0.2 of base2.js HOT 3
- Consider relying on HTML ClassList API
- :checked pseudo-class doesn't match selected option elements.
- Non ascii strings broken when encoded HOT 1
- classList.remove can incorrectly trigger IE's onpropertychange event.
- Allow Base cast specialization HOT 1
- Patch for /trunk/src/apps/packer/Base62.js HOT 1
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 base2.