Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
build: release 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Dec 20, 2018
1 parent 7afb925 commit 2c402de
Show file tree
Hide file tree
Showing 13 changed files with 356 additions and 245 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.3 (Dec 20, 2018)

- Ignore hours, minutes, seconds and milliseconds of parsed date to avoid side effect (#192)
- Fix day view when the selected day is not in the current year (#194).

## 1.0.2 (Dec 15, 2018)

- Convert 2-digit year to 2000+ (#186).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> A simple jQuery datepicker plugin.
- [Website](https://fengyuanchen.github.io/datepicker/)
- [Website](https://fengyuanchen.github.io/datepicker)

## Table of contents

Expand Down
73 changes: 37 additions & 36 deletions dist/datepicker.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Datepicker v1.0.2
* Datepicker v1.0.3
* https://fengyuanchen.github.io/datepicker
*
* Copyright 2014-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-12-15T03:52:10.525Z
* Date: 2018-12-20T12:51:42.329Z
*/

'use strict';
Expand Down Expand Up @@ -484,50 +484,49 @@ var methods = {
var format = this.format;
var parts = [];

if (isDate(date)) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
if (!isDate(date)) {
if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}

if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}
date = date ? new Date(date) : new Date();

var parsedDate = date ? new Date(date) : new Date();
if (!isDate(date)) {
date = new Date();
}

if (!isDate(parsedDate)) {
parsedDate = new Date();
}
if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);

if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);
switch (format.parts[i]) {
case 'dd':
case 'd':
date.setDate(value);
break;

switch (format.parts[i]) {
case 'dd':
case 'd':
parsedDate.setDate(value);
break;
case 'mm':
case 'm':
date.setMonth(value - 1);
break;

case 'mm':
case 'm':
parsedDate.setMonth(value - 1);
break;
case 'yy':
date.setFullYear(2000 + value);
break;

case 'yy':
parsedDate.setFullYear(2000 + value);
break;
case 'yyyy':
// Converts 2-digit year to 2000+
date.setFullYear(part.length === 2 ? 2000 + value : value);
break;

case 'yyyy':
// Converts 2-digit year to 2000+
parsedDate.setFullYear(part.length === 2 ? 2000 + value : value);
break;
default:
}
});
}
} // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192)

default:
}
});
}

return parsedDate;
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
},

/**
Expand Down Expand Up @@ -706,8 +705,10 @@ var handlers = {
}

viewDay = parseInt($target.text(), 10);
date.setFullYear(viewYear);
date.setMonth(viewMonth);
date.setDate(viewDay);
viewDate.setFullYear(viewYear);
viewDate.setMonth(viewMonth);
viewDate.setDate(viewDay);
this.renderDays();
Expand Down
4 changes: 2 additions & 2 deletions dist/datepicker.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Datepicker v1.0.2
* Datepicker v1.0.3
* https://fengyuanchen.github.io/datepicker
*
* Copyright 2014-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-12-15T03:52:06.949Z
* Date: 2018-12-20T12:51:39.076Z
*/

.datepicker-container {
Expand Down
73 changes: 37 additions & 36 deletions dist/datepicker.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Datepicker v1.0.2
* Datepicker v1.0.3
* https://fengyuanchen.github.io/datepicker
*
* Copyright 2014-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-12-15T03:52:10.525Z
* Date: 2018-12-20T12:51:42.329Z
*/

import $ from 'jquery';
Expand Down Expand Up @@ -480,50 +480,49 @@ var methods = {
var format = this.format;
var parts = [];

if (isDate(date)) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
if (!isDate(date)) {
if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}

if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}
date = date ? new Date(date) : new Date();

var parsedDate = date ? new Date(date) : new Date();
if (!isDate(date)) {
date = new Date();
}

if (!isDate(parsedDate)) {
parsedDate = new Date();
}
if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);

if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);
switch (format.parts[i]) {
case 'dd':
case 'd':
date.setDate(value);
break;

switch (format.parts[i]) {
case 'dd':
case 'd':
parsedDate.setDate(value);
break;
case 'mm':
case 'm':
date.setMonth(value - 1);
break;

case 'mm':
case 'm':
parsedDate.setMonth(value - 1);
break;
case 'yy':
date.setFullYear(2000 + value);
break;

case 'yy':
parsedDate.setFullYear(2000 + value);
break;
case 'yyyy':
// Converts 2-digit year to 2000+
date.setFullYear(part.length === 2 ? 2000 + value : value);
break;

case 'yyyy':
// Converts 2-digit year to 2000+
parsedDate.setFullYear(part.length === 2 ? 2000 + value : value);
break;
default:
}
});
}
} // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192)

default:
}
});
}

return parsedDate;
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
},

/**
Expand Down Expand Up @@ -702,8 +701,10 @@ var handlers = {
}

viewDay = parseInt($target.text(), 10);
date.setFullYear(viewYear);
date.setMonth(viewMonth);
date.setDate(viewDay);
viewDate.setFullYear(viewYear);
viewDate.setMonth(viewMonth);
viewDate.setDate(viewDay);
this.renderDays();
Expand Down
79 changes: 40 additions & 39 deletions dist/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*!
* Datepicker v1.0.2
* Datepicker v1.0.3
* https://fengyuanchen.github.io/datepicker
*
* Copyright 2014-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-12-15T03:52:10.525Z
* Date: 2018-12-20T12:51:42.329Z
*/

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
(factory(global.jQuery));
}(this, (function ($) { 'use strict';
(global = global || self, factory(global.jQuery));
}(this, function ($) { 'use strict';

$ = $ && $.hasOwnProperty('default') ? $['default'] : $;

Expand Down Expand Up @@ -486,50 +486,49 @@
var format = this.format;
var parts = [];

if (isDate(date)) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
if (!isDate(date)) {
if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}

if (isString(date)) {
parts = date.match(REGEXP_DIGITS) || [];
}
date = date ? new Date(date) : new Date();

var parsedDate = date ? new Date(date) : new Date();
if (!isDate(date)) {
date = new Date();
}

if (!isDate(parsedDate)) {
parsedDate = new Date();
}
if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);

if (parts.length === format.parts.length) {
$.each(parts, function (i, part) {
var value = parseInt(part, 10);
switch (format.parts[i]) {
case 'dd':
case 'd':
date.setDate(value);
break;

switch (format.parts[i]) {
case 'dd':
case 'd':
parsedDate.setDate(value);
break;
case 'mm':
case 'm':
date.setMonth(value - 1);
break;

case 'mm':
case 'm':
parsedDate.setMonth(value - 1);
break;
case 'yy':
date.setFullYear(2000 + value);
break;

case 'yy':
parsedDate.setFullYear(2000 + value);
break;
case 'yyyy':
// Converts 2-digit year to 2000+
date.setFullYear(part.length === 2 ? 2000 + value : value);
break;

case 'yyyy':
// Converts 2-digit year to 2000+
parsedDate.setFullYear(part.length === 2 ? 2000 + value : value);
break;
default:
}
});
}
} // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192)

default:
}
});
}

return parsedDate;
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
},

/**
Expand Down Expand Up @@ -708,8 +707,10 @@
}

viewDay = parseInt($target.text(), 10);
date.setFullYear(viewYear);
date.setMonth(viewMonth);
date.setDate(viewDay);
viewDate.setFullYear(viewYear);
viewDate.setMonth(viewMonth);
viewDate.setDate(viewDay);
this.renderDays();
Expand Down Expand Up @@ -1493,4 +1494,4 @@
};
}

})));
}));
4 changes: 2 additions & 2 deletions dist/datepicker.min.css

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

Loading

0 comments on commit 2c402de

Please sign in to comment.