Skip to content

Commit

Permalink
v1.2.0rc4 Fix issue in month selector that cause selecting month in o…
Browse files Browse the repository at this point in the history
…ther years doesnt affect selected date year
  • Loading branch information
babakhani committed Jun 1, 2019
1 parent 424ab2b commit 5154f0e
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persian-datepicker",
"version": "1.2.0-rc3",
"version": "1.2.0-rc4",
"main": [
"dist/css/persian-datepicker.min.css",
"dist/js/persian-datepicker.min.js"
Expand Down
2 changes: 1 addition & 1 deletion dist/css/persian-datepicker.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** persian-datepicker - v1.2.0-rc3
** persian-datepicker - v1.2.0-rc4
** Reza Babakhani <babakhani.reza@gmail.com>
** http://babakhani.github.io/PersianWebToolkit/docs/datepicker
** Under MIT license
Expand Down
2 changes: 1 addition & 1 deletion dist/css/persian-datepicker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/theme/persian-datepicker-blue.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/theme/persian-datepicker-cheerup.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/theme/persian-datepicker-dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/theme/persian-datepicker-redblack.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions dist/js/persian-datepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** persian-datepicker - v1.2.0-rc3
** persian-datepicker - v1.2.0-rc4
** Reza Babakhani <babakhani.reza@gmail.com>
** http://babakhani.github.io/PersianWebToolkit/docs/datepicker
** Under MIT license
Expand Down Expand Up @@ -168,7 +168,7 @@ module.exports = Helper;
/**
* @type {string}
*/
var Template = "\n<div id=\"plotId\" class=\"datepicker-plot-area {{cssClass}}\">\n {{#navigator.enabled}}\n <div data-navigator class=\"datepicker-navigator\">\n <div class=\"pwt-btn pwt-btn-next\">{{navigator.text.btnNextText}}</div>\n <div class=\"pwt-btn pwt-btn-switch\">{{navigator.switch.text}}</div>\n <div class=\"pwt-btn pwt-btn-prev\">{{navigator.text.btnPrevText}}</div>\n </div>\n {{/navigator.enabled}}\n <div class=\"datepicker-grid-view\" >\n {{#days.enabled}}\n {{#days.viewMode}}\n <div class=\"datepicker-day-view\" > \n <div class=\"month-grid-box\">\n <div class=\"header\">\n <div class=\"title\"></div>\n <div class=\"header-row\">\n {{#weekdays.list}}\n <div class=\"header-row-cell\">{{.}}</div>\n {{/weekdays.list}}\n </div>\n </div> \n <table cellspacing=\"0\" class=\"table-days\">\n <tbody>\n {{#days.list}}\n \n <tr>\n {{#.}}\n {{#enabled}}\n <td data-date=\"{{dataDate}}\" data-unix=\"{{dataUnix}}\" >\n <span class=\"{{#otherMonth}}other-month{{/otherMonth}}\">{{title}}</span>\n {{#altCalendarShowHint}}\n <i class=\"alter-calendar-day\">{{alterCalTitle}}</i>\n {{/altCalendarShowHint}}\n </td>\n {{/enabled}}\n {{^enabled}}\n <td data-date=\"{{dataDate}}\" data-unix=\"{{dataUnix}}\" class=\"disabled\">\n <span class=\"{{#otherMonth}}other-month{{/otherMonth}}\">{{title}}</span>\n {{#altCalendarShowHint}}\n <i class=\"alter-calendar-day\">{{alterCalTitle}}</i>\n {{/altCalendarShowHint}}\n </td>\n {{/enabled}}\n \n {{/.}}\n </tr>\n {{/days.list}}\n </tbody>\n </table>\n </div>\n </div>\n {{/days.viewMode}}\n {{/days.enabled}}\n \n {{#month.enabled}}\n {{#month.viewMode}}\n <div class=\"datepicker-month-view\">\n {{#month.list}}\n {{#enabled}} \n <div data-month=\"{{dataMonth}}\" class=\"month-item {{#selected}}selected{{/selected}}\">{{title}}</small></div>\n {{/enabled}}\n {{^enabled}} \n <div data-month=\"{{dataMonth}}\" class=\"month-item month-item-disable {{#selected}}selected{{/selected}}\">{{title}}</small></div>\n {{/enabled}}\n {{/month.list}}\n </div>\n {{/month.viewMode}}\n {{/month.enabled}}\n \n {{#year.enabled }}\n {{#year.viewMode }}\n <div class=\"datepicker-year-view\" >\n {{#year.list}}\n {{#enabled}}\n <div data-year=\"{{dataYear}}\" class=\"year-item {{#selected}}selected{{/selected}}\">{{title}}</div>\n {{/enabled}}\n {{^enabled}}\n <div data-year=\"{{dataYear}}\" class=\"year-item year-item-disable {{#selected}}selected{{/selected}}\">{{title}}</div>\n {{/enabled}} \n {{/year.list}}\n </div>\n {{/year.viewMode }}\n {{/year.enabled }}\n \n </div>\n {{#time}}\n {{#enabled}}\n <div class=\"datepicker-time-view\">\n {{#hour.enabled}}\n <div class=\"hour time-segment\" data-time-key=\"hour\">\n <div class=\"up-btn\" data-time-key=\"hour\">\u25B2</div>\n <input disabled value=\"{{hour.title}}\" type=\"text\" placeholder=\"hour\" class=\"hour-input\">\n <div class=\"down-btn\" data-time-key=\"hour\">\u25BC</div> \n </div> \n <div class=\"divider\">\n <span>:</span>\n </div>\n {{/hour.enabled}}\n {{#minute.enabled}}\n <div class=\"minute time-segment\" data-time-key=\"minute\" >\n <div class=\"up-btn\" data-time-key=\"minute\">\u25B2</div>\n <input disabled value=\"{{minute.title}}\" type=\"text\" placeholder=\"minute\" class=\"minute-input\">\n <div class=\"down-btn\" data-time-key=\"minute\">\u25BC</div>\n </div> \n <div class=\"divider second-divider\">\n <span>:</span>\n </div>\n {{/minute.enabled}}\n {{#second.enabled}}\n <div class=\"second time-segment\" data-time-key=\"second\" >\n <div class=\"up-btn\" data-time-key=\"second\" >\u25B2</div>\n <input disabled value=\"{{second.title}}\" type=\"text\" placeholder=\"second\" class=\"second-input\">\n <div class=\"down-btn\" data-time-key=\"second\" >\u25BC</div>\n </div>\n <div class=\"divider meridian-divider\"></div>\n <div class=\"divider meridian-divider\"></div>\n {{/second.enabled}}\n {{#meridian.enabled}}\n <div class=\"meridian time-segment\" data-time-key=\"meridian\" >\n <div class=\"up-btn\" data-time-key=\"meridian\">\u25B2</div>\n <input disabled value=\"{{meridian.title}}\" type=\"text\" class=\"meridian-input\">\n <div class=\"down-btn\" data-time-key=\"meridian\">\u25BC</div>\n </div>\n {{/meridian.enabled}}\n </div>\n {{/enabled}}\n {{/time}}\n \n {{#toolbox}}\n {{#enabled}}\n <div class=\"toolbox\">\n {{#toolbox.submitButton.enabled}}\n <div class=\"pwt-btn-submit\">{{submitButtonText}}</div>\n {{/toolbox.submitButton.enabled}} \n {{#toolbox.todayButton.enabled}}\n <div class=\"pwt-btn-today\">{{todayButtonText}}</div>\n {{/toolbox.todayButton.enabled}} \n {{#toolbox.calendarSwitch.enabled}}\n <div class=\"pwt-btn-calendar\">{{calendarSwitchText}}</div>\n {{/toolbox.calendarSwitch.enabled}}\n </div>\n {{/enabled}}\n {{^enabled}}\n {{#onlyTimePicker}}\n <div class=\"toolbox\">\n <div class=\"pwt-btn-submit\">{{submitButtonText}}</div>\n </div>\n {{/onlyTimePicker}}\n {{/enabled}}\n {{/toolbox}}\n</div>\n";
var Template = "\n<div id=\"plotId\" class=\"datepicker-plot-area {{cssClass}}\">\n {{#navigator.enabled}}\n <div data-navigator class=\"datepicker-navigator\">\n <div class=\"pwt-btn pwt-btn-next\">{{navigator.text.btnNextText}}</div>\n <div class=\"pwt-btn pwt-btn-switch\">{{navigator.switch.text}}</div>\n <div class=\"pwt-btn pwt-btn-prev\">{{navigator.text.btnPrevText}}</div>\n </div>\n {{/navigator.enabled}}\n <div class=\"datepicker-grid-view\" >\n {{#days.enabled}}\n {{#days.viewMode}}\n <div class=\"datepicker-day-view\" > \n <div class=\"month-grid-box\">\n <div class=\"header\">\n <div class=\"title\"></div>\n <div class=\"header-row\">\n {{#weekdays.list}}\n <div class=\"header-row-cell\">{{.}}</div>\n {{/weekdays.list}}\n </div>\n </div> \n <table cellspacing=\"0\" class=\"table-days\">\n <tbody>\n {{#days.list}}\n \n <tr>\n {{#.}}\n {{#enabled}}\n <td data-date=\"{{dataDate}}\" data-unix=\"{{dataUnix}}\" >\n <span class=\"{{#otherMonth}}other-month{{/otherMonth}}\">{{title}}</span>\n {{#altCalendarShowHint}}\n <i class=\"alter-calendar-day\">{{alterCalTitle}}</i>\n {{/altCalendarShowHint}}\n </td>\n {{/enabled}}\n {{^enabled}}\n <td data-date=\"{{dataDate}}\" data-unix=\"{{dataUnix}}\" class=\"disabled\">\n <span class=\"{{#otherMonth}}other-month{{/otherMonth}}\">{{title}}</span>\n {{#altCalendarShowHint}}\n <i class=\"alter-calendar-day\">{{alterCalTitle}}</i>\n {{/altCalendarShowHint}}\n </td>\n {{/enabled}}\n \n {{/.}}\n </tr>\n {{/days.list}}\n </tbody>\n </table>\n </div>\n </div>\n {{/days.viewMode}}\n {{/days.enabled}}\n \n {{#month.enabled}}\n {{#month.viewMode}}\n <div class=\"datepicker-month-view\">\n {{#month.list}}\n {{#enabled}} \n <div data-year=\"{{year}}\" data-month=\"{{dataMonth}}\" class=\"month-item {{#selected}}selected{{/selected}}\">{{title}}</small></div>\n {{/enabled}}\n {{^enabled}} \n <div data-year=\"{{year}}\"data-month=\"{{dataMonth}}\" class=\"month-item month-item-disable {{#selected}}selected{{/selected}}\">{{title}}</small></div>\n {{/enabled}}\n {{/month.list}}\n </div>\n {{/month.viewMode}}\n {{/month.enabled}}\n \n {{#year.enabled }}\n {{#year.viewMode }}\n <div class=\"datepicker-year-view\" >\n {{#year.list}}\n {{#enabled}}\n <div data-year=\"{{dataYear}}\" class=\"year-item {{#selected}}selected{{/selected}}\">{{title}}</div>\n {{/enabled}}\n {{^enabled}}\n <div data-year=\"{{dataYear}}\" class=\"year-item year-item-disable {{#selected}}selected{{/selected}}\">{{title}}</div>\n {{/enabled}} \n {{/year.list}}\n </div>\n {{/year.viewMode }}\n {{/year.enabled }}\n \n </div>\n {{#time}}\n {{#enabled}}\n <div class=\"datepicker-time-view\">\n {{#hour.enabled}}\n <div class=\"hour time-segment\" data-time-key=\"hour\">\n <div class=\"up-btn\" data-time-key=\"hour\">\u25B2</div>\n <input disabled value=\"{{hour.title}}\" type=\"text\" placeholder=\"hour\" class=\"hour-input\">\n <div class=\"down-btn\" data-time-key=\"hour\">\u25BC</div> \n </div> \n <div class=\"divider\">\n <span>:</span>\n </div>\n {{/hour.enabled}}\n {{#minute.enabled}}\n <div class=\"minute time-segment\" data-time-key=\"minute\" >\n <div class=\"up-btn\" data-time-key=\"minute\">\u25B2</div>\n <input disabled value=\"{{minute.title}}\" type=\"text\" placeholder=\"minute\" class=\"minute-input\">\n <div class=\"down-btn\" data-time-key=\"minute\">\u25BC</div>\n </div> \n <div class=\"divider second-divider\">\n <span>:</span>\n </div>\n {{/minute.enabled}}\n {{#second.enabled}}\n <div class=\"second time-segment\" data-time-key=\"second\" >\n <div class=\"up-btn\" data-time-key=\"second\" >\u25B2</div>\n <input disabled value=\"{{second.title}}\" type=\"text\" placeholder=\"second\" class=\"second-input\">\n <div class=\"down-btn\" data-time-key=\"second\" >\u25BC</div>\n </div>\n <div class=\"divider meridian-divider\"></div>\n <div class=\"divider meridian-divider\"></div>\n {{/second.enabled}}\n {{#meridian.enabled}}\n <div class=\"meridian time-segment\" data-time-key=\"meridian\" >\n <div class=\"up-btn\" data-time-key=\"meridian\">\u25B2</div>\n <input disabled value=\"{{meridian.title}}\" type=\"text\" class=\"meridian-input\">\n <div class=\"down-btn\" data-time-key=\"meridian\">\u25BC</div>\n </div>\n {{/meridian.enabled}}\n </div>\n {{/enabled}}\n {{/time}}\n \n {{#toolbox}}\n {{#enabled}}\n <div class=\"toolbox\">\n {{#toolbox.submitButton.enabled}}\n <div class=\"pwt-btn-submit\">{{submitButtonText}}</div>\n {{/toolbox.submitButton.enabled}} \n {{#toolbox.todayButton.enabled}}\n <div class=\"pwt-btn-today\">{{todayButtonText}}</div>\n {{/toolbox.todayButton.enabled}} \n {{#toolbox.calendarSwitch.enabled}}\n <div class=\"pwt-btn-calendar\">{{calendarSwitchText}}</div>\n {{/toolbox.calendarSwitch.enabled}}\n </div>\n {{/enabled}}\n {{^enabled}}\n {{#onlyTimePicker}}\n <div class=\"toolbox\">\n <div class=\"pwt-btn-submit\">{{submitButtonText}}</div>\n </div>\n {{/onlyTimePicker}}\n {{/enabled}}\n {{/toolbox}}\n</div>\n";

module.exports = Template;

Expand Down Expand Up @@ -2001,8 +2001,10 @@ var Navigator = function () {
*/
$(document).on('click', '#' + that.model.view.id + ' .datepicker-month-view .month-item:not(.month-item-disable)', function () {
var month = $(this).data('month');
var year = $(this).data('year');
that.model.state.switchViewModeTo('day');
if (!that.model.options.onlySelectOnDate) {
that.model.state.setSelectedDateTime('year', year);
that.model.state.setSelectedDateTime('month', month);
if (that.model.options.autoClose) {
that.model.view.hide();
Expand Down
4 changes: 2 additions & 2 deletions dist/js/persian-datepicker.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.2.0-rc4] - 2019-06-01
- Fix issue in month selector that cause selecting month in other years doesnt
affect selected date year

## [1.2.0-rc3] - 2018-04-07
- Fix [#279](https://github.com/babakhani/pwt.datepicker/issues/279)
- Fix [#288](https://github.com/babakhani/pwt.datepicker/issues/288)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persian-datepicker",
"version": "1.2.0-rc3",
"version": "1.2.0-rc4",
"mian": "dist/js/persian-datepicker.js",
"description": "jQuery datepicker plugin work with Iranian calendar.",
"keywords": [
Expand Down
2 changes: 2 additions & 0 deletions src/es6/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ class Navigator {
*/
$(document).on('click', '#' + that.model.view.id + ' .datepicker-month-view .month-item:not(.month-item-disable)', function () {
let month = $(this).data('month');
let year = $(this).data('year');
that.model.state.switchViewModeTo('day');
if (!that.model.options.onlySelectOnDate) {
that.model.state.setSelectedDateTime('year', year);
that.model.state.setSelectedDateTime('month', month);
if (that.model.options.autoClose) {
that.model.view.hide();
Expand Down
4 changes: 2 additions & 2 deletions src/es6/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const Template = `
<div class="datepicker-month-view">
{{#month.list}}
{{#enabled}}
<div data-month="{{dataMonth}}" class="month-item {{#selected}}selected{{/selected}}">{{title}}</small></div>
<div data-year="{{year}}" data-month="{{dataMonth}}" class="month-item {{#selected}}selected{{/selected}}">{{title}}</small></div>
{{/enabled}}
{{^enabled}}
<div data-month="{{dataMonth}}" class="month-item month-item-disable {{#selected}}selected{{/selected}}">{{title}}</small></div>
<div data-year="{{year}}"data-month="{{dataMonth}}" class="month-item month-item-disable {{#selected}}selected{{/selected}}">{{title}}</small></div>
{{/enabled}}
{{/month.list}}
</div>
Expand Down

0 comments on commit 5154f0e

Please sign in to comment.