From ff1035a355613792f73fb84491f278b4e8a4b132 Mon Sep 17 00:00:00 2001 From: Alex Gabriel Date: Fri, 8 Jan 2016 13:21:06 -0800 Subject: [PATCH 1/5] Add gulp watch task. --- gulpfile.babel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index a425c0e..41a48d3 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -6,7 +6,6 @@ import del from 'del'; const $ = gulpLoadPlugins(); - requireDir('./tasks'); gulp.task('clean', del.bind(null, ['.tmp', '.publish', 'dist'])); @@ -20,3 +19,7 @@ gulp.task('travis-ci', ['build:website'], () => { gulp.task('default', ['clean'], () => { gulp.start('build'); }); + +gulp.task('watch', ['default'], () => { + gulp.watch('src/**/*', ['default']); +}); From ec42fe1a115bafd84ec97470c48c515c9e17e24d Mon Sep 17 00:00:00 2001 From: Alex Gabriel Date: Fri, 8 Jan 2016 13:21:23 -0800 Subject: [PATCH 2/5] Fix 'next' arrow sometimes not being shown when there are valid dates in next period. This happens when the max date is in the bottom "row" of the calendar in day/week view. --- .../calendar-header-view.coffee | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/scripts/daterangepicker/calendar-header-view.coffee b/src/scripts/daterangepicker/calendar-header-view.coffee index 7c29b31..e626b48 100644 --- a/src/scripts/daterangepicker/calendar-header-view.coffee +++ b/src/scripts/daterangepicker/calendar-header-view.coffee @@ -54,11 +54,21 @@ class CalendarHeaderView {'arrow-hidden': !@currentDate.isWithinBoundaries(date)} nextArrowCss: -> - [cols, rows] = @period.dimentions() - date = @firstDate().clone().add(cols * rows, @period()) - {'arrow-hidden': !@currentDate.isWithinBoundaries(date)} - - + currentDate = @currentDate().clone() + + # Calculate the _first_ available date in the next period + nextPeriodDate = + # Day and week calendars are displayed 'monthly' (6 weeks) + if @period() in ['day', 'week'] + currentDate.endOf('month').add(1, 'day') + # Month and quarter calendars are displayed yearly + else if @period() in ['month', 'quarter'] + currentDate.endOf('year').add(1, 'day') + # Year calendar is displayed in 10 year chunks + else if @period() == 'year' + @firstYearOfDecade(currentDate).add(10, 'year') + + {'arrow-hidden': !@currentDate.isWithinBoundaries(nextPeriodDate)} monthOptions: -> minMonth = if @currentDate.minBoundary().isSame(@currentDate(), 'year') then @currentDate.minBoundary().month() else 0 From 8c64b8cfb8090a9a71e06cae20fd116fe7d20eff Mon Sep 17 00:00:00 2001 From: Dmitry Filimonov Date: Wed, 13 Jan 2016 18:42:51 +0300 Subject: [PATCH 3/5] nextArrowCss improvements for day / week cases --- .../calendar-header-view.coffee | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/scripts/daterangepicker/calendar-header-view.coffee b/src/scripts/daterangepicker/calendar-header-view.coffee index e626b48..ffb12c4 100644 --- a/src/scripts/daterangepicker/calendar-header-view.coffee +++ b/src/scripts/daterangepicker/calendar-header-view.coffee @@ -54,21 +54,10 @@ class CalendarHeaderView {'arrow-hidden': !@currentDate.isWithinBoundaries(date)} nextArrowCss: -> - currentDate = @currentDate().clone() - - # Calculate the _first_ available date in the next period - nextPeriodDate = - # Day and week calendars are displayed 'monthly' (6 weeks) - if @period() in ['day', 'week'] - currentDate.endOf('month').add(1, 'day') - # Month and quarter calendars are displayed yearly - else if @period() in ['month', 'quarter'] - currentDate.endOf('year').add(1, 'day') - # Year calendar is displayed in 10 year chunks - else if @period() == 'year' - @firstYearOfDecade(currentDate).add(10, 'year') - - {'arrow-hidden': !@currentDate.isWithinBoundaries(nextPeriodDate)} + [cols, rows] = @period.dimentions() + date = @firstDate().clone().add(cols * rows, @period()) + date = date.startOf('month') if @period() in ['day', 'week'] + {'arrow-hidden': !@currentDate.isWithinBoundaries(date)} monthOptions: -> minMonth = if @currentDate.minBoundary().isSame(@currentDate(), 'year') then @currentDate.minBoundary().month() else 0 From 4412b3faaaf592d21ecb3b69a83a3ee95b98b3e0 Mon Sep 17 00:00:00 2001 From: Dmitry Filimonov Date: Wed, 13 Jan 2016 18:43:46 +0300 Subject: [PATCH 4/5] prevArrowCss improvement for day / week case --- src/scripts/daterangepicker/calendar-header-view.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scripts/daterangepicker/calendar-header-view.coffee b/src/scripts/daterangepicker/calendar-header-view.coffee index ffb12c4..e58b145 100644 --- a/src/scripts/daterangepicker/calendar-header-view.coffee +++ b/src/scripts/daterangepicker/calendar-header-view.coffee @@ -51,6 +51,7 @@ class CalendarHeaderView prevArrowCss: -> date = @firstDate().clone().subtract(1, 'millisecond') + date = date.endOf('month') if @period() in ['day', 'week'] {'arrow-hidden': !@currentDate.isWithinBoundaries(date)} nextArrowCss: -> From 3aaa71d7c5266a2c9eedd820910cd606e22e0535 Mon Sep 17 00:00:00 2001 From: Dmitry Filimonov Date: Wed, 13 Jan 2016 18:54:03 +0300 Subject: [PATCH 5/5] deleted the watch tasks because it's the same as serve --- gulpfile.babel.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 41a48d3..937d634 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -19,7 +19,3 @@ gulp.task('travis-ci', ['build:website'], () => { gulp.task('default', ['clean'], () => { gulp.start('build'); }); - -gulp.task('watch', ['default'], () => { - gulp.watch('src/**/*', ['default']); -});