You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/04/22 17:21:08 UTC
svn commit: r936895 -
/click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js
Author: sabob
Date: Thu Apr 22 15:21:08 2010
New Revision: 936895
URL: http://svn.apache.org/viewvc?rev=936895&view=rev
Log:
upgraded to latest calendar date select 1.16.1
Modified:
click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js
Modified: click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js?rev=936895&r1=936894&r2=936895&view=diff
==============================================================================
--- click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js (original)
+++ click/trunk/click/extras/src/META-INF/resources/click/calendar/calendar_date_select.js Thu Apr 22 15:21:08 2010
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-// CalendarDateSelect version 1.15 - a prototype based date picker
+// CalendarDateSelect version 1.16.1 - a prototype based date picker
// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
@@ -254,8 +254,7 @@ CalendarDateSelect.prototype = {
} else if (! this.options.get("buttons")) buttons_div.remove();
if (this.options.get("buttons")) {
- var sep = this.options.get("time") ? "<br/>" : " ";
- buttons_div.build("span", {innerHTML: sep});
+ buttons_div.build("span", {innerHTML: " "});
if (this.options.get("time")=="mixed" || !this.options.get("time")) b = buttons_div.build("a", {
innerHTML: _translations["Today"],
href: "#",
@@ -377,9 +376,14 @@ CalendarDateSelect.prototype = {
parseDate: function()
{
var value = $F(this.target_element).strip()
- this.selection_made = (value != "");
+ var default_time = this.options.get("default_time");
+ this.selection_made = (value != "" || default_time);
this.date = value=="" ? NaN : Date.parseFormattedString(this.options.get("date") || value, this.options.get("formatValue"));
- if (isNaN(this.date)) this.date = new Date();
+ if (isNaN(this.date) && !default_time)
+ this.date = new Date();
+ else if (isNaN(this.date) && default_time)
+ this.date = (Object.prototype.toString.apply(default_time) === '[object Function]') ? default_time() : default_time;
+
if (!this.validYear(this.date.getFullYear())) this.date.setYear( (this.date.getFullYear() < this.yearRange().start) ? this.yearRange().start : this.yearRange().end);
this.selected_date = new Date(this.date);
this.use_time = /[0-9]:[0-9]{2}/.exec(value) ? true : false;
@@ -406,9 +410,9 @@ CalendarDateSelect.prototype = {
if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
if (parts.get("day")) {
var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
- for (var x = 0; x<=3; x++) t_selected_date.setDate(parts.get("day"));
t_selected_date.setYear(parts.get("year"));
t_selected_date.setMonth(parts.get("month"));
+ t_selected_date.setDate(parts.get("day"));
if (vdc && ! vdc(t_selected_date.stripTime())) { return false; }
this.selected_date = t_selected_date;
@@ -469,7 +473,7 @@ CalendarDateSelect.prototype = {
today: function(now) {
var d = new Date(); this.date = new Date();
var o = $H({ day: d.getDate(), month: d.getMonth(), year: d.getFullYear(), hour: d.getHours(), minute: d.getMinutes()});
- if ( ! now ) o = o.merge({hour: "", minute:""});
+ if ( ! now ) o = o.merge({hour: "", minute:""});
this.updateSelectedDate(o, true);
this.refresh();
},
@@ -958,4 +962,4 @@ Date.parseFormattedString = function(str
* 2009-05-11: Added ability to pass date format as options argument
* 2009-05-11: Added format argument for Date.prototype.toFormattedString
* and Date.parseFormattedString functions
- */
\ No newline at end of file
+ */