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

Commit

Permalink
Release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Oct 15, 2016
1 parent 53fbfac commit 3e4394f
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 48 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog


## 0.4.0 (Oct 15, 2016)

- Rename `autoshow` option to `autoShow`.
- Rename `autohide` option to `autoHide`.
- Rename `autopick` option to `autoPick`.
- Improved the priority of language options.
- Fixed the issue of date view updating (#33).


## 0.3.1 (Jan 11, 2016)

- Fixed the issue of `startDate` option (#20)
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

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



## Table of contents

- [Features](#features)
- [Main](#main)
- [Getting started](#getting-started)
- [Options](#options)
- [Methods](#methods)
- [Events](#events)
- [I18n](#i18n)
- [No conflict](#no-conflict)
- [Browser support](#browser-support)
- [Versioning](#versioning)
- [License](#license)
- [Features](#features)
- [Main](#main)
- [Getting started](#getting-started)
- [Options](#options)
- [Methods](#methods)
- [Events](#events)
- [I18n](#i18n)
- [No conflict](#no-conflict)
- [Browser support](#browser-support)
- [Versioning](#versioning)
- [License](#license)



Expand All @@ -41,7 +41,7 @@ dist/
├── datepicker.css ( 4 KB)
├── datepicker.min.css ( 4 KB)
├── datepicker.js (38 KB)
└── datepicker.min.js (15 KB)
└── datepicker.min.js (16 KB)
```


Expand Down Expand Up @@ -94,23 +94,23 @@ You may set datepicker options with `$().datepicker(options)`.
If you want to change the global default options, You may use `$.fn.datepicker.setDefaults(options)`.


### autoshow
### autoShow

- Type: `Boolean`
- Default: `false`

Show the datepicker automatically when initialized.


### autohide
### autoHide

- Type: `Boolean`
- Default: `false`

Hide the datepicker automatically when picked.


### autopick
### autoPick

- Type: `Boolean`
- Default: `false`
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 v0.3.1
* Datepicker v0.4.0
* https://github.com/fengyuanchen/datepicker
*
* Copyright (c) 2014-2016 Fengyuan Chen
* Released under the MIT license
*
* Date: 2016-01-11T04:07:30.531Z
* Date: 2016-10-15T04:28:09.384Z
*/
.datepicker-container {
font-size: 12px;
Expand Down
52 changes: 33 additions & 19 deletions dist/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Datepicker v0.3.1
* Datepicker v0.4.0
* https://github.com/fengyuanchen/datepicker
*
* Copyright (c) 2014-2016 Fengyuan Chen
* Released under the MIT license
*
* Date: 2016-01-11T04:07:25.661Z
* Date: 2016-10-15T04:28:08.752Z
*/

(function (factory) {
Expand Down Expand Up @@ -161,6 +161,7 @@
options = $.isPlainObject(options) ? options : {};

if (options.language) {
// Priority: Datepicker.DEFAULTS < Datepicker.LANGUAGES < options
options = $.extend({}, Datepicker.LANGUAGES[options.language], options);
}

Expand Down Expand Up @@ -191,7 +192,7 @@
this.isInput = $this.is('input') || $this.is('textarea');
this.isInline = options.inline && (options.container || !this.isInput);
this.format = parseFormat(options.format);
this.initialValue = this.getValue();
this.oldValue = this.initialValue = this.getValue();
date = this.parseDate(date || this.initialValue);

if (startDate) {
Expand Down Expand Up @@ -224,11 +225,11 @@

this.bind();

if (options.autoshow || this.isInline) {
if (options.autoShow || this.isInline) {
this.show();
}

if (options.autopick) {
if (options.autoPick) {
this.pick();
}
},
Expand Down Expand Up @@ -394,7 +395,7 @@
},

hideView: function () {
if (this.options.autohide) {
if (this.options.autoHide) {
this.hide();
}
},
Expand Down Expand Up @@ -1034,7 +1035,14 @@

// Update the datepicker with the current input value
update: function () {
this.setDate(this.getValue(), true);
var value = this.getValue();

if (value === this.oldValue) {
return;
}

this.setDate(value, true);
this.oldValue = value;
},

/**
Expand Down Expand Up @@ -1126,13 +1134,13 @@
/**
* Get the current date
*
* @param {Boolean} formated (optional)
* @param {Boolean} formatted (optional)
* @return {Date|String} (date)
*/
getDate: function (formated) {
getDate: function (formatted) {
var date = this.date;

return formated ? this.formatDate(date) : new Date(date);
return formatted ? this.formatDate(date) : new Date(date);
},

/**
Expand Down Expand Up @@ -1257,19 +1265,19 @@
* Format a date object to a string with the set date format
*
* @param {Date} date
* @return {String} (formated date)
* @return {String} (formatted date)
*/
formatDate: function (date) {
var format = this.format;
var formated = '';
var formatted = '';
var length;
var year;
var part;
var val;
var i;

if (isDate(date)) {
formated = format.source;
formatted = format.source;
year = date.getFullYear();
val = {
d: date.getDate(),
Expand All @@ -1284,11 +1292,11 @@

for (i = 0; i < length; i++) {
part = format.parts[i];
formated = formated.replace(part, val[part]);
formatted = formatted.replace(part, val[part]);
}
}

return formated;
return formatted;
},

// Destroy the datepicker and remove the instance from the target element
Expand All @@ -1303,13 +1311,13 @@

Datepicker.DEFAULTS = {
// Show the datepicker automatically when initialized
autoshow: false,
autoShow: false,

// Hide the datepicker automatically when picked
autohide: false,
autoHide: false,

// Pick the initial date automatically when initialized
autopick: false,
autoPick: false,

// Enable inline mode
inline: false,
Expand Down Expand Up @@ -1421,7 +1429,13 @@
};

Datepicker.setDefaults = function (options) {
$.extend(Datepicker.DEFAULTS, $.isPlainObject(options) && options);
options = $.isPlainObject(options) ? options : {};

if (options.language) {
options = $.extend({}, Datepicker.LANGUAGES[options.language], options);
}

$.extend(Datepicker.DEFAULTS, options);
};

// Save the other datepicker
Expand Down
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 3e4394f

Please sign in to comment.