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

Differences to moment? #58

Closed
flosse opened this issue Apr 25, 2018 · 17 comments
Closed

Differences to moment? #58

flosse opened this issue Apr 25, 2018 · 17 comments

Comments

@flosse
Copy link

flosse commented Apr 25, 2018

Could you add a section to the README.md that explains the differences to moment? Why is it faster/smaller? What features are missing? Are the parts of the API that are different? What was your motivation to "reinvent" the wheel?

@ghost
Copy link

ghost commented Apr 25, 2018

+1

@perrupa
Copy link

perrupa commented Apr 27, 2018

This is probably going to be the question front of mind for most people considering DayJS: Why DayJS instead of MomentJS?

Personally, my team is moving away from moment and I'd like to know what tradeoffs I'd be making by choosing DayJS and if it meets my needs or not (eg: timezones or i18n concerns).

Either way, best of luck. This looks like an incredible project! 👍

@iamkun
Copy link
Owner

iamkun commented Apr 28, 2018

Will do

@acrazing
Copy link

Is dayjs fully compatible with moment? I hope to use alias in webpack to replace moment with dayjs, but I cannot ensure if it is ok to do it. Is there any guidelines?

@naulacambra
Copy link
Contributor

There are some functions that are not yet implemented, and others are available through plugins. Try to change the alias, and see if everything works fine

@acrazing
Copy link

Well, I found the second argument of Dayjs#diff is different, it accepts singular but Moment#diff accepts plural.

@ghost
Copy link

ghost commented Dec 21, 2018

@acrazing Dayjs accepts both I think

@acrazing
Copy link

@xxyuk um.. I use typescript to check it, its singular only and is required in index.d.ts: https://github.com/iamkun/dayjs/blob/master/index.d.ts#L57

@ghost
Copy link

ghost commented Dec 21, 2018

Oh I see.

We might could update it like this ? I'm not sure


export type UnitType = 'millisecond' | 'milliseconds' | 'second' | 'seconds' | 'minute' | 'minutes' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | 'date'

But I'm not good with TS, anyone could send a PR to fix this?

@zediah
Copy link

zediah commented Apr 11, 2019

One thing I've just come across that's different is Moment accepts an array on constructor - e.g. moment([2018, 1, 1]) but dayjs doesn't seem to know how to parse this.

@ghost
Copy link

ghost commented Apr 11, 2019

@zediah Yes, Day.js can't parse array or object at this time.

@ghost
Copy link

ghost commented Apr 11, 2019

https://github.com/you-dont-need/You-Dont-Need-Momentjs

Here is a simple comparison between Day.js, Moment.js, Luxon, Native Date and Date-fns.

@sandstrom
Copy link

Would also be good if the readme mentioned Luxon, which is an immutable moment-js descendent.

@niftylettuce
Copy link

It looks like all of these Get + Set functions are missing from dayjs, even with all plugins enabled https://momentjs.com/docs/#/get-set/

@ghost
Copy link

ghost commented Oct 11, 2019

@niftylettuce may be you are wrong.

@niftylettuce
Copy link

@xxyuk correct, I am wrong in the sense that the plural versions are not available, https://github.com/iamkun/dayjs/blob/dev/docs/en/API-reference.md#get-and-set, e.g. hour() exists but not its alias hours(). just discovered this.

@iamkun
Copy link
Owner

iamkun commented Aug 4, 2020

Please see #58 (comment)

@iamkun iamkun closed this as completed Aug 4, 2020
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

No branches or pull requests

8 participants