Permalink
Browse files

Added a new "current_date" property for setting the date picker's "to…

…day" value; this answers #74
  • Loading branch information...
stefangabos committed Oct 27, 2018
1 parent 8087da4 commit ad8a47514ce6a2628883d3c915ce0f2ca38e8606
Showing with 29 additions and 9 deletions.
  1. +8 −0 README.md
  2. +1 −1 dist/zebra_datepicker.min.js
  3. +10 −4 dist/zebra_datepicker.src.js
  4. +10 −4 src/zebra_datepicker.src.js
View
@@ -163,6 +163,14 @@ var datepicker = $('selector').data('Zebra_DatePicker');
By default, the date picker is injected into the document's <code>&lt;body&gt;</code> element; use this property to tell the library to inject the date picker into a custom element - useful when you want the date picker to open at a specific position.
</td>
</tr>
<tr>
<td valign="top"><a name="container"></a><strong>current_date</strong></td>
<td valign="top"><em>mixed</em></td>
<td valign="top"><code>false</code></td>
<td valign="top">
By default, the current date (the value of <em>Today</em>) is taken from the system where the date picker is run on.<br>Set this to a date in the format of <code>YYYY-MM-DD</code> to use a different date.
</td>
</tr>
<tr>
<td valign="top"><a name="custom_classes"></a><strong>custom_classes</strong></td>
<td valign="top"><em>Array</em></td>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -6,7 +6,7 @@
* Read more {@link https://github.com/stefangabos/Zebra_Datepicker/ here}
*
* @author Stefan Gabos <contact@stefangabos.ro>
* @version 1.9.11 (last revision: October 26, 2018)
* @version 1.9.11 (last revision: October 27, 2018)
* @copyright (c) 2011 - 2018 Stefan Gabos
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
* @package Zebra_DatePicker
@@ -55,6 +55,12 @@
// default is $('body')
container: $('body'),
// by default, the current date (the value of *Today*) is taken from the system where the date picker is run on.
// set this to a date in the format of 'YYYY-MM-DD' to use a different date.
//
// default is FALSE which means "the current system's date"
current_date: false,
// dates that should have custom classes applied to them
// an object in the form of
// {
@@ -758,8 +764,8 @@
var
// cache the current system date
date = new Date(),
// cache the current date (which is either the system's date or a custom one, if given)
date = plugin.settings.current_date !== false ? new Date(plugin.settings.current_date) : new Date(),
// when the date picker's starting date depends on the value of another date picker, this value will be
// set by the other date picker
@@ -1545,7 +1551,7 @@
selecttoday.on('click', function(e) {
// date might have changed since we opened the date picker, so always use the current date
var date = new Date();
var date = plugin.settings.current_date !== false ? new Date(plugin.settings.current_date) : new Date();
e.preventDefault();
@@ -6,7 +6,7 @@
* Read more {@link https://github.com/stefangabos/Zebra_Datepicker/ here}
*
* @author Stefan Gabos <contact@stefangabos.ro>
* @version 1.9.11 (last revision: October 26, 2018)
* @version 1.9.11 (last revision: October 27, 2018)
* @copyright (c) 2011 - 2018 Stefan Gabos
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE
* @package Zebra_DatePicker
@@ -55,6 +55,12 @@
// default is $('body')
container: $('body'),
// by default, the current date (the value of *Today*) is taken from the system where the date picker is run on.
// set this to a date in the format of 'YYYY-MM-DD' to use a different date.
//
// default is FALSE which means "the current system's date"
current_date: false,
// dates that should have custom classes applied to them
// an object in the form of
// {
@@ -758,8 +764,8 @@
var
// cache the current system date
date = new Date(),
// cache the current date (which is either the system's date or a custom one, if given)
date = plugin.settings.current_date !== false ? new Date(plugin.settings.current_date) : new Date(),
// when the date picker's starting date depends on the value of another date picker, this value will be
// set by the other date picker
@@ -1545,7 +1551,7 @@
selecttoday.on('click', function(e) {
// date might have changed since we opened the date picker, so always use the current date
var date = new Date();
var date = plugin.settings.current_date !== false ? new Date(plugin.settings.current_date) : new Date();
e.preventDefault();

0 comments on commit ad8a475

Please sign in to comment.