longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 580 forks source link

Reduce plugin bundle size #165

Open tommiehansen opened 9 years ago

tommiehansen commented 9 years ago

Any possibilities for a lighter version and dumping the requirements for Moment.js? As it is now the whole package clocks in at close to 100+ kb which is a tad much only for using a calendar.

There are alternatives to moment.js as well like fecha https://github.com/taylorhakes/fecha , xdate js etc.

As it is now the datepicker is filled with every feature imaginable. Maybe create extensions instead so that the core can be a bit lighter?

tommiehansen commented 9 years ago

No interest i see... i decided to write my own instead. The goal is to have a fully functional date-range picker under 5kb (minified, non-gzip).

The problem with this library is it's size. 63kb + moment.js (23kb) is quite huge for only a datepicker....

longbill commented 8 years ago

Yes, you're right. The size is too big especially when it is used on a mobile site.

suluke commented 8 years ago

I wanted to draw your attention to my fork of this project. It is quite extensive, but it is still working as a drop-in replacement on the demo page. As part of the refactoring, I try to split the functionality into several browserify modules, which in turn can be excluded from the compiled library. So far, I have only extracted the language strings and the time-selection functionality, but I am sure there's more to come. The minified library my build produces is only 30Kb when those features are left out.
@longbill I don't mean to be hijacking your project here. I am very grateful for your fantastic library. I am eager to hear your opinion on my work so far. Maybe we can find a way to return some of it into your repository? Be warned, though, I have modified the structure of the project quite heavily

tommiehansen commented 8 years ago

@longbill Yes, exactly. I need something that works well on broadband but would work well on smaller screens or poor connections (imagine sitting on a subway or even being in-flight between New York and Cancun) as well. Usually a datepicker component is only one of the things one load therefor my comment about 63+23kb being way too much just for the purpose of picking two dates.

Anyway -- i've began coding such a thing myself with more specific usecases (light + loads of features isn't possible). It isn't easy, but it can be done. :+1:

tommiehansen commented 8 years ago

@suluke Sounds great, but 30kb is still much when consideringen something of a base for a datepicker component.

monovertex commented 6 years ago

I agree with the arguments presented here and I believe we can greatly reduce the bundle size. The first step would be to extract i18n into separate locale files. After that we can probably start exploring replacing moment.js.