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

Remove isDate #471

Merged
merged 2 commits into from Apr 6, 2017
Merged

Remove isDate #471

merged 2 commits into from Apr 6, 2017

Conversation

leshakoss
Copy link
Contributor

No description provided.

@leshakoss leshakoss merged commit 145eb3a into v2 Apr 6, 2017
@leshakoss leshakoss deleted the v2-remove-isDate branch April 6, 2017 07:07
leshakoss added a commit that referenced this pull request Apr 14, 2017
* Remove `isDate`

* Add CHANGELOG.md entry for `isDate` removal
leshakoss added a commit that referenced this pull request May 4, 2017
* Remove `isDate`

* Add CHANGELOG.md entry for `isDate` removal
leshakoss added a commit that referenced this pull request May 20, 2017
* Remove `isDate`

* Add CHANGELOG.md entry for `isDate` removal
leshakoss added a commit that referenced this pull request May 20, 2017
* Remove `isDate`

* Add CHANGELOG.md entry for `isDate` removal
kossnocorp pushed a commit that referenced this pull request Jun 20, 2017
* Remove `isDate`

* Add CHANGELOG.md entry for `isDate` removal
@YarnSphere
Copy link

Sorry to comment on this old pull request, but why was this functionality removed?
Calling instanceof Date fails when Date objects are passed across frames.
Other libraries such as lodash instead do something like:

typeof date === 'object' && Object.prototype.toString.call(date) === '[object Date]'

See lodash implementation (which seems to have a performance optimisation for Node.js): https://github.com/lodash/lodash/blob/master/isDate.js

I see no reason why this function shouldn't be provided by date-fns.
Thank you for your work!

@YarnSphere
Copy link

Just adding that a proper implementation of isDate would solve #541.
Calling instanceof is indeed not a good practice on a functional library such as date-fns since pure functions shouldn't access global state (and Date is a global variable).

Just leaving my two cents here.

@kossnocorp
Copy link
Member

@nunocastromartins this is a very good point. @leshakoss WDYT?

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

Successfully merging this pull request may close these issues.

None yet

3 participants