React-native-calendars: Migrate from XDate to moment.js

Created on 13 Feb 2018  路  10Comments  路  Source: wix/react-native-calendars

Change underlying date implementation

stale

Most helpful comment

Alternatives I would propose instead:

https://date-fns.org/
https://github.com/moment/luxon

Even better, providing props to consumers so we can provide our own date library or implementation without taking on another dependency!

All 10 comments

Will be PR accepted if I'll implement this? It 10 PRs almost there, idk how fast they are accepted

Hi, PRs are merged approx once a month. It also depends on quality of PR and responsiveness of author if it will be merged.

Ok, it makes sense.
What about to use some linting tools? Do you like eslint airbnb preset?

The lint is configured use npm run lint command

I would strongly discourage this switchover. Moment.js, while popular, is infamously bloated (particularly due to its locales) and would be forcing adoption of an enormous dependency on end users. XDate is 3k gzipped, moment is 16.4k gzipped, and moment-with-locales is a whopping 66.3k gzipped!

Alternatives I would propose instead:

https://date-fns.org/
https://github.com/moment/luxon

Even better, providing props to consumers so we can provide our own date library or implementation without taking on another dependency!

@davidgoli thanks for update. I am also not sure if moment.js will bring more benefits so I am not sure about this refactor. I want to use date library that has immutable date objects, AFAIK neither XDate or Moment.js support this. This leads to various weird bugs.

Either way react-native-calendars exposes date objects that are time-library agnostic, so we can refactor anytime when good alternative lib appears.

@tautvilas both date-fns and luxon use immutable objects, for what it's worth.

@goldenhammer @ethanshar @sibelius I like the idea of using date-fns and would like to contribute. Can I start working on it and see how it goes?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sommeshEwall picture sommeshEwall  路  3Comments

joaosauer picture joaosauer  路  4Comments

anishtr4 picture anishtr4  路  3Comments

microwin168 picture microwin168  路  4Comments

ercpereda picture ercpereda  路  4Comments