t1m0n / air-datepicker

Lightweight, dependency-free JavaScript datepicker.
https://air-datepicker.com
MIT License
2.61k stars 1.36k forks source link

Is this project dead? #273

Open artknight opened 6 years ago

artknight commented 6 years ago

not seeing any work done/PRs merged... in a long time!

artknight commented 6 years ago

@t1m0n Thank you again for the wonderful work you have done!

Suggestion, if you do not have time to maintain this project perhaps you can allow someone else to do that. :)

t1m0n commented 6 years ago

I hope it is not! Actually I have a lot of main job, and all my attempts to improve calendar moving veeeeeeeeery slow. I hope to release new version this year with possibility to render multiple calendars. This task was not so easy as expected, and that is another reason why release is being delayed. Nevertheless, I think that everything will work out and the release will take place, sooner or later.

Thanks for your support!

artknight commented 6 years ago

@t1m0n I implemented it into one of my projects and I ended up making a bunch of changes to the lib to make it work. Here are the changes:

  1. Updated the CSS class to .airdatepicker b/c it was interfering with other date pickers I was using in my project. Also updated the constructor to $.fn.airdatepicker.. again b/c other date/time pickers use the same name space.

  2. Allowed the picker to be opened on any element, not just an input field this.$el[this.elIsInput?'val':'text'](value);

  3. Moved some code out of _triggerOnChange into separate methods to re-use them from the event methods

    _getFormattedDates: function(){
            return this.selectedDates
                .map(function(date){ return this.formatDate(this.loc.dateFormat, date); }.bind(this))
                .join(this.opts.multipleDatesSeparator);
        },
    
        _getDates: function(){
            var selectedDates = this.selectedDates,
                parsedSelected = datepicker.getParsedDate(selectedDates[0]),
                dates = new Date(
                    parsedSelected.year,
                    parsedSelected.month,
                    parsedSelected.date,
                    parsedSelected.hours,
                    parsedSelected.minutes
                );
    
            // Create new dates array, to separate it from original selectedDates
            if (this.opts.multipleDates || this.opts.range) {
                dates = selectedDates.map(function(date){
                    var parsedDate = datepicker.getParsedDate(date);
    
                    return new Date(
                        parsedDate.year,
                        parsedDate.month,
                        parsedDate.date,
                        parsedDate.hours,
                        parsedDate.minutes
                    );
                })
            }
    
            return dates;
        },
                _triggerOnChange: function(){
                       if (!this.selectedDates.length) {
                            // Prevent from triggering multiple onSelect callback with same argument (empty string) in IE10-11
                if (this._prevOnSelectValue === '') return;
                this._prevOnSelectValue = '';
                return this.opts.onSelect('', '', this);
            }
    
            var formatted_dates = this._getFormattedDates(),
                dates = this._getDates();
    
            this._prevOnSelectValue = formatted_dates;
            this.opts.onSelect(formatted_dates, dates, this);
        },

I am also attaching the full file for you to code compare if need be.

Art air-datepicker.js.zip

t1m0n commented 6 years ago

Thanks for sharing, but I didn't figured out how to render multiple calendars in your version?

artknight commented 6 years ago

@t1m0n what do you mean? not following :(

naton commented 6 years ago

@t1m0n By "multiple calendars", do you mean displaying multiple months in each datepicker popup, or something else? (Multiple datepickers on the same page seems to work quite nice, I mean)

t1m0n commented 6 years ago

@naton Yes, it's about displaying multiple months/years in one datepicker instance. I've already done some work on this task, but can't find enough time to complete it.

yersskit commented 5 years ago

Awesome work!! we love air datepicker a lot!, can't wait for new relases, multiple months in one view is a great idea and i will use in a near future.

lekhnath commented 1 year ago

@naton Yes, it's about displaying multiple months/years in one datepicker instance. I've already done some work on this task, but can't find enough time to complete it.

@t1m0n First of all kudos for this awesome project. I also need multiple months view for date range picker. Any progress on this one?