Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date.parse is not compatible with native Date.parse #1189

Open
dmartensson opened this issue Mar 21, 2013 · 4 comments
Open

Date.parse is not compatible with native Date.parse #1189

dmartensson opened this issue Mar 21, 2013 · 4 comments
Milestone

Comments

@dmartensson
Copy link

dmartensson commented Mar 21, 2013

MooTools Date.parse method returns a Date object while the native Date.parse method returns milliseconds.

This breaks third party code that depends on parse for timestamps, and the cause is hard to find.

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/359711-date-parse-is-not-compatible-with-native-date-parse?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22069&utm_medium=issues&utm_source=github).
@d-s-e
Copy link

d-s-e commented May 6, 2015

I just stumbled across this issue while updating some old libraries.
The bug seems to be somewhere in MooTools More.
In the past, we had a customized version, which didn't have the bug, and with the update I installed More with all features.
The problem is, I can't remember, which features I used in the customized version ...

@dmartensson
Copy link
Author

Well, MooTools by default overwrites the native Date.parse method of the native Date object with it's own parse method that returns a Date object instead of a number.

We have a site analysis tool that uses a small javascript our customers add to their page to get goal tracking and survey support.

Our script used the Date.parse method and when a customer using MooTools added our script it did not work since the native Date object's parse method no longer returned the correct data.

This causes very difficult to debug errors.

Se you docs compared to native javascript docs

http://mootools.net/more/docs/1.5.1/Types/Date#Date:parse
vs
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse

The documentation does not even mention that your parse method differs from js native.

@SergioCrisostomo SergioCrisostomo added this to the 1.6.0 milestone May 6, 2015
@SergioCrisostomo
Copy link
Member

Just added 1.6 milestone so we review/adress this in next version.

@d-s-e
Copy link

d-s-e commented May 6, 2015

It's a very bad idea to overwrite native functions and not return the expected result!
Why is this done anyway? This doesn't make much sense to me, but maybe I don't see the "big picture" ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants