charliekassel / vuejs-datepicker

A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
MIT License
2.61k stars 730 forks source link

Consider delegating date utils to date-fns #211

Open MarcPorciuncula opened 7 years ago

MarcPorciuncula commented 7 years ago

date-fns is a date utility library that I use all the time, I think there would be value in using date-fns instead of maintaining date utils just for this package.

From the readme of this package:

Date formatting

NB. This is not very robust at all - use at your own risk! Needs a better implementation.

I'm mostly interested in this because date-fns provides a formatting function that supports more output formats.

It exports every function separately, so you only include what you need in the final bundle, and there's also some stuff about importing only languages you actually use.

This would be a breaking change as the date format syntax is different in date-fns. Happy to work on a pull for this one if you like the idea.

charliekassel commented 7 years ago

That looks like a really nice library - thanks for the information. I've been holding off on integrating moment due to the size of it, but with date-fns it looks like you can import specific functions. I'd definitely be interested in seeing a PR for this if you'd like to work on this @MarcoThePoro

rtheunissen commented 7 years ago

@charliekassel projects that use dates most likely already has moment as a dependency (or should have).

I don't think it's a bad idea to use it for the parsing, formatting, and validation of dates. We would use this package in a flash if it didn't implement that logic itself, so would like to request that you delegate to moment.

TynesideGroup commented 6 years ago

@rtheunissen Saying that projects that use date should have Moment as a dependency is a terrible assumption. There are a lot of modern, and better, alternatives out there now such as date-fns that don't require a huge 300kb+ dependency in your project.

Even someone on the Moment team has been working on a modular alternative: http://isaaccambron.com/luxon/docs/

@charliekassel I am currently working through your projects to use date-fns where appropriate - I'll send a pull request when completed.