Skip to content

Commit

Permalink
fixed #388
Browse files Browse the repository at this point in the history
  • Loading branch information
Atanas Atanasov committed Jul 15, 2018
1 parent 70ba903 commit a43d8cf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 deletions.
16 changes: 7 additions & 9 deletions dist/combined/js/gijgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -14691,28 +14691,25 @@ gj.datepicker.methods = {
var date, month, year, decade, century,
$calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

year = parseInt($calendar.attr('year'), 10);
switch ($calendar.attr('type')) {
case 'month':
month = parseInt($calendar.attr('month'), 10);
year = parseInt($calendar.attr('year'), 10);
date = gj.datepicker.methods.getPrevMonth(month, year);
$calendar.attr('month', date.month);
$calendar.attr('year', date.year);
gj.datepicker.methods.renderMonth($datepicker, $calendar, data);
break;
case 'year':
year = parseInt($calendar.attr('year'), 10);
$calendar.attr('year', year - 1);
gj.datepicker.methods.renderYear($datepicker, $calendar, data);
break;
case 'decade':
year = parseInt($calendar.attr('year'), 10);
decade = year - (year % 10);
$calendar.attr('year', decade - 10);
gj.datepicker.methods.renderDecade($datepicker, $calendar, data);
break;
case 'century':
year = parseInt($calendar.attr('year'), 10);
century = year - (year % 100);
$calendar.attr('year', century - 100);
gj.datepicker.methods.renderCentury($datepicker, $calendar, data);
Expand All @@ -14726,28 +14723,25 @@ gj.datepicker.methods = {
var date, month, year, decade, century,
$calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

year = parseInt($calendar.attr('year'), 10);
switch ($calendar.attr('type')) {
case 'month':
month = parseInt($calendar.attr('month'), 10);
year = parseInt($calendar.attr('year'), 10);
date = gj.datepicker.methods.getNextMonth(month, year);
$calendar.attr('month', date.month);
$calendar.attr('year', date.year);
gj.datepicker.methods.renderMonth($datepicker, $calendar, data);
break;
case 'year':
year = parseInt($calendar.attr('year'), 10);
$calendar.attr('year', year + 1);
gj.datepicker.methods.renderYear($datepicker, $calendar, data);
break;
case 'decade':
year = parseInt($calendar.attr('year'), 10);
decade = year - (year % 10);
$calendar.attr('year', decade + 10);
gj.datepicker.methods.renderDecade($datepicker, $calendar, data);
break;
case 'century':
year = parseInt($calendar.attr('year'), 10);
century = year - (year % 100);
$calendar.attr('year', century + 100);
gj.datepicker.methods.renderCentury($datepicker, $calendar, data);
Expand Down Expand Up @@ -14835,10 +14829,14 @@ gj.datepicker.methods = {
},

open: function ($datepicker, data) {
var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
var date, $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

if ($datepicker.val()) {
$datepicker.value($datepicker.val());
} else {
date = new Date();
$calendar.attr("month", date.getMonth());
$calendar.attr("year", date.getFullYear());
}

switch ($calendar.attr('type')) {
Expand Down
2 changes: 1 addition & 1 deletion dist/combined/js/gijgo.min.js

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions dist/modular/js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,28 +596,25 @@ gj.datepicker.methods = {
var date, month, year, decade, century,
$calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

year = parseInt($calendar.attr('year'), 10);
switch ($calendar.attr('type')) {
case 'month':
month = parseInt($calendar.attr('month'), 10);
year = parseInt($calendar.attr('year'), 10);
date = gj.datepicker.methods.getPrevMonth(month, year);
$calendar.attr('month', date.month);
$calendar.attr('year', date.year);
gj.datepicker.methods.renderMonth($datepicker, $calendar, data);
break;
case 'year':
year = parseInt($calendar.attr('year'), 10);
$calendar.attr('year', year - 1);
gj.datepicker.methods.renderYear($datepicker, $calendar, data);
break;
case 'decade':
year = parseInt($calendar.attr('year'), 10);
decade = year - (year % 10);
$calendar.attr('year', decade - 10);
gj.datepicker.methods.renderDecade($datepicker, $calendar, data);
break;
case 'century':
year = parseInt($calendar.attr('year'), 10);
century = year - (year % 100);
$calendar.attr('year', century - 100);
gj.datepicker.methods.renderCentury($datepicker, $calendar, data);
Expand All @@ -631,28 +628,25 @@ gj.datepicker.methods = {
var date, month, year, decade, century,
$calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

year = parseInt($calendar.attr('year'), 10);
switch ($calendar.attr('type')) {
case 'month':
month = parseInt($calendar.attr('month'), 10);
year = parseInt($calendar.attr('year'), 10);
date = gj.datepicker.methods.getNextMonth(month, year);
$calendar.attr('month', date.month);
$calendar.attr('year', date.year);
gj.datepicker.methods.renderMonth($datepicker, $calendar, data);
break;
case 'year':
year = parseInt($calendar.attr('year'), 10);
$calendar.attr('year', year + 1);
gj.datepicker.methods.renderYear($datepicker, $calendar, data);
break;
case 'decade':
year = parseInt($calendar.attr('year'), 10);
decade = year - (year % 10);
$calendar.attr('year', decade + 10);
gj.datepicker.methods.renderDecade($datepicker, $calendar, data);
break;
case 'century':
year = parseInt($calendar.attr('year'), 10);
century = year - (year % 100);
$calendar.attr('year', century + 100);
gj.datepicker.methods.renderCentury($datepicker, $calendar, data);
Expand Down Expand Up @@ -740,10 +734,14 @@ gj.datepicker.methods = {
},

open: function ($datepicker, data) {
var $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');
var date, $calendar = $('body').find('[role="calendar"][guid="' + $datepicker.attr('data-guid') + '"]');

if ($datepicker.val()) {
$datepicker.value($datepicker.val());
} else {
date = new Date();
$calendar.attr("month", date.getMonth());
$calendar.attr("year", date.getFullYear());
}

switch ($calendar.attr('type')) {
Expand Down
Loading

0 comments on commit a43d8cf

Please sign in to comment.