When comparing date-fns vs XDate, the Slant community recommends date-fns for most people. In the question“What are the best JavaScript date formatting libraries?” date-fns is ranked 1st while XDate is ranked 6th. The most important reason people chose date-fns is:
Developers can pick only the functions they need to reduce the size of the library that's being downloaded (using bundlers such as webpack or browserify)
Ranked in these QuestionsQuestion Ranking
Pros
Pro Modular
Developers can pick only the functions they need to reduce the size of the library that's being downloaded (using bundlers such as webpack or browserify)
Pro Immutable
Uses pure functions and always returns a new date object to prevent unexpected results.
Cons
Con Their "distance in words" function is not very customizable
When comparing a certain date to the current date the function returns a pretty "opinionated" sentence such as "almost 2 years" which can't really be customizable and requires string manipulation to fit result to your needs.