Lib_Js_Calendar - Version 1.3.2

Version Notes

1.3.2

Download this release

Release Info

Developer Magento Core Team
Extension Lib_Js_Calendar
Version 1.3.2
Comparing to
See all releases


Code changes from version 1.3.1 to 1.3.2

Files changed (2) hide show
  1. js/calendar/calendar.js +38 -20
  2. package.xml +5 -5
js/calendar/calendar.js CHANGED
@@ -416,7 +416,7 @@ Calendar.tableMouseUp = function(ev) {
416
  var mon = Calendar.findMonth(target);
417
  var date = null;
418
  if (mon) {
419
- date = new Date(cal.date);
420
  if (mon.month != date.getMonth()) {
421
  date.setMonth(mon.month);
422
  cal.setDate(date);
@@ -426,7 +426,7 @@ Calendar.tableMouseUp = function(ev) {
426
  } else {
427
  var year = Calendar.findYear(target);
428
  if (year) {
429
- date = new Date(cal.date);
430
  if (year.year != date.getFullYear()) {
431
  date.setFullYear(year.year);
432
  cal.setDate(date);
@@ -660,7 +660,7 @@ Calendar.cellClick = function(el, ev) {
660
  date = cal.date;
661
  var other_month = !(cal.dateClicked = !el.otherMonth);
662
  if (!other_month && !cal.currentDateEl)
663
- cal._toggleMultipleDate(new Date(date));
664
  else
665
  newdate = !el.disabled;
666
  // a date was clicked
@@ -672,9 +672,9 @@ Calendar.cellClick = function(el, ev) {
672
  cal.callCloseHandler();
673
  return;
674
  }
675
- date = new Date(cal.date);
676
  if (el.navtype == 0)
677
- date.setDateOnly(new Date()); // TODAY
678
  // unless "today" was clicked, we assume no date was clicked so
679
  // the selected handler will know not to close the calenar when
680
  // in single-click mode.
@@ -795,7 +795,7 @@ Calendar.prototype.create = function (_par) {
795
  parent = _par;
796
  this.isPopup = false;
797
  }
798
- this.date = this.dateStr ? new Date(this.dateStr) : new Date();
799
 
800
  var table = Calendar.createElement("table");
801
  this.table = table;
@@ -1074,12 +1074,12 @@ Calendar._keyEvent = function(ev) {
1074
  ne = cal.ar_days[y][x];
1075
  };setVars();
1076
  function prevMonth() {
1077
- var date = new Date(cal.date);
1078
  date.setDate(date.getDate() - step);
1079
  cal.setDate(date);
1080
  };
1081
  function nextMonth() {
1082
- var date = new Date(cal.date);
1083
  date.setDate(date.getDate() + step);
1084
  cal.setDate(date);
1085
  };
@@ -1146,7 +1146,7 @@ Calendar._keyEvent = function(ev) {
1146
  * (RE)Initializes the calendar to the given date and firstDayOfWeek
1147
  */
1148
  Calendar.prototype._init = function (firstDayOfWeek, date) {
1149
- var today = new Date(),
1150
  TY = today.getFullYear(),
1151
  TM = today.getMonth(),
1152
  TD = today.getDate();
@@ -1160,7 +1160,7 @@ Calendar.prototype._init = function (firstDayOfWeek, date) {
1160
  date.setFullYear(year);
1161
  }
1162
  this.firstDayOfWeek = firstDayOfWeek;
1163
- this.date = new Date(date);
1164
  var month = date.getMonth();
1165
  var mday = date.getDate();
1166
  var no_days = date.getMonthDays();
@@ -1231,7 +1231,7 @@ Calendar.prototype._init = function (firstDayOfWeek, date) {
1231
  }
1232
  }
1233
  if (!cell.disabled) {
1234
- cell.caldate = new Date(date);
1235
  cell.ttip = "_";
1236
  if (!this.multiple && current_month
1237
  && iday == mday && this.hiliteToday) {
@@ -1256,7 +1256,7 @@ Calendar.prototype._init = function (firstDayOfWeek, date) {
1256
  this.table.style.visibility = "visible";
1257
  this._initMultipleDates();
1258
  // PROFILE
1259
- // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
1260
  };
1261
 
1262
  Calendar.prototype._initMultipleDates = function() {
@@ -1649,7 +1649,7 @@ Date.DAY = 24 * Date.HOUR;
1649
  Date.WEEK = 7 * Date.DAY;
1650
 
1651
  Date.parseDate = function(str, fmt) {
1652
- var today = new Date();
1653
  var y = 0;
1654
  var m = -1;
1655
  var d = 0;
@@ -1731,7 +1731,7 @@ Date.parseDate = function(str, fmt) {
1731
  if (isNaN(hr)) hr = today.getHours();
1732
  if (isNaN(min)) min = today.getMinutes();
1733
  if (y != 0 && m != -1 && d != 0)
1734
- return new Date(y, m, d, hr, min, 0);
1735
  y = 0; m = -1; d = 0;
1736
  for (i = 0; i < a.length; ++i) {
1737
  if (a[i].search(/[a-zA-Z]+/) != -1) {
@@ -1757,7 +1757,7 @@ Date.parseDate = function(str, fmt) {
1757
  if (y == 0)
1758
  y = today.getFullYear();
1759
  if (m != -1 && d != 0)
1760
- return new Date(y, m, d, hr, min, 0);
1761
  return today;
1762
  };
1763
 
@@ -1776,15 +1776,15 @@ Date.prototype.getMonthDays = function(month) {
1776
 
1777
  /** Returns the number of day in the year. */
1778
  Date.prototype.getDayOfYear = function() {
1779
- var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1780
- var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
1781
  var time = now - then;
1782
  return Math.floor(time / Date.DAY);
1783
  };
1784
 
1785
  /** Returns the number of the week in year, as defined in ISO 8601. */
1786
  Date.prototype.getWeekNumber = function() {
1787
- var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1788
  var DoW = d.getDay();
1789
  d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
1790
  var ms = d.valueOf(); // GMT
@@ -1804,7 +1804,7 @@ Date.prototype.equalsTo = function(date) {
1804
 
1805
  /** Set only the year, month, date parts (keep existing time) */
1806
  Date.prototype.setDateOnly = function(date) {
1807
- var tmp = new Date(date);
1808
  this.setDate(1);
1809
  this.setFullYear(tmp.getFullYear());
1810
  this.setMonth(tmp.getMonth());
@@ -1880,13 +1880,31 @@ Date.prototype.print = function (str) {
1880
 
1881
  Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
1882
  Date.prototype.setFullYear = function(y) {
1883
- var d = new Date(this);
1884
  d.__msh_oldSetFullYear(y);
1885
  if (d.getMonth() != this.getMonth())
1886
  this.setDate(28);
1887
  this.__msh_oldSetFullYear(y);
1888
  };
1889
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1890
  // END: DATE OBJECT PATCHES
1891
 
1892
 
416
  var mon = Calendar.findMonth(target);
417
  var date = null;
418
  if (mon) {
419
+ date = new CalendarDateObject(cal.date);
420
  if (mon.month != date.getMonth()) {
421
  date.setMonth(mon.month);
422
  cal.setDate(date);
426
  } else {
427
  var year = Calendar.findYear(target);
428
  if (year) {
429
+ date = new CalendarDateObject(cal.date);
430
  if (year.year != date.getFullYear()) {
431
  date.setFullYear(year.year);
432
  cal.setDate(date);
660
  date = cal.date;
661
  var other_month = !(cal.dateClicked = !el.otherMonth);
662
  if (!other_month && !cal.currentDateEl)
663
+ cal._toggleMultipleDate(new CalendarDateObject(date));
664
  else
665
  newdate = !el.disabled;
666
  // a date was clicked
672
  cal.callCloseHandler();
673
  return;
674
  }
675
+ date = new CalendarDateObject(cal.date);
676
  if (el.navtype == 0)
677
+ date.setDateOnly(new CalendarDateObject()); // TODAY
678
  // unless "today" was clicked, we assume no date was clicked so
679
  // the selected handler will know not to close the calenar when
680
  // in single-click mode.
795
  parent = _par;
796
  this.isPopup = false;
797
  }
798
+ this.date = this.dateStr ? new CalendarDateObject(this.dateStr) : new CalendarDateObject();
799
 
800
  var table = Calendar.createElement("table");
801
  this.table = table;
1074
  ne = cal.ar_days[y][x];
1075
  };setVars();
1076
  function prevMonth() {
1077
+ var date = new CalendarDateObject(cal.date);
1078
  date.setDate(date.getDate() - step);
1079
  cal.setDate(date);
1080
  };
1081
  function nextMonth() {
1082
+ var date = new CalendarDateObject(cal.date);
1083
  date.setDate(date.getDate() + step);
1084
  cal.setDate(date);
1085
  };
1146
  * (RE)Initializes the calendar to the given date and firstDayOfWeek
1147
  */
1148
  Calendar.prototype._init = function (firstDayOfWeek, date) {
1149
+ var today = new CalendarDateObject(),
1150
  TY = today.getFullYear(),
1151
  TM = today.getMonth(),
1152
  TD = today.getDate();
1160
  date.setFullYear(year);
1161
  }
1162
  this.firstDayOfWeek = firstDayOfWeek;
1163
+ this.date = new CalendarDateObject(date);
1164
  var month = date.getMonth();
1165
  var mday = date.getDate();
1166
  var no_days = date.getMonthDays();
1231
  }
1232
  }
1233
  if (!cell.disabled) {
1234
+ cell.caldate = new CalendarDateObject(date);
1235
  cell.ttip = "_";
1236
  if (!this.multiple && current_month
1237
  && iday == mday && this.hiliteToday) {
1256
  this.table.style.visibility = "visible";
1257
  this._initMultipleDates();
1258
  // PROFILE
1259
+ // this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms";
1260
  };
1261
 
1262
  Calendar.prototype._initMultipleDates = function() {
1649
  Date.WEEK = 7 * Date.DAY;
1650
 
1651
  Date.parseDate = function(str, fmt) {
1652
+ var today = new CalendarDateObject();
1653
  var y = 0;
1654
  var m = -1;
1655
  var d = 0;
1731
  if (isNaN(hr)) hr = today.getHours();
1732
  if (isNaN(min)) min = today.getMinutes();
1733
  if (y != 0 && m != -1 && d != 0)
1734
+ return new CalendarDateObject(y, m, d, hr, min, 0);
1735
  y = 0; m = -1; d = 0;
1736
  for (i = 0; i < a.length; ++i) {
1737
  if (a[i].search(/[a-zA-Z]+/) != -1) {
1757
  if (y == 0)
1758
  y = today.getFullYear();
1759
  if (m != -1 && d != 0)
1760
+ return new CalendarDateObject(y, m, d, hr, min, 0);
1761
  return today;
1762
  };
1763
 
1776
 
1777
  /** Returns the number of day in the year. */
1778
  Date.prototype.getDayOfYear = function() {
1779
+ var now = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1780
+ var then = new CalendarDateObject(this.getFullYear(), 0, 0, 0, 0, 0);
1781
  var time = now - then;
1782
  return Math.floor(time / Date.DAY);
1783
  };
1784
 
1785
  /** Returns the number of the week in year, as defined in ISO 8601. */
1786
  Date.prototype.getWeekNumber = function() {
1787
+ var d = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1788
  var DoW = d.getDay();
1789
  d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
1790
  var ms = d.valueOf(); // GMT
1804
 
1805
  /** Set only the year, month, date parts (keep existing time) */
1806
  Date.prototype.setDateOnly = function(date) {
1807
+ var tmp = new CalendarDateObject(date);
1808
  this.setDate(1);
1809
  this.setFullYear(tmp.getFullYear());
1810
  this.setMonth(tmp.getMonth());
1880
 
1881
  Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
1882
  Date.prototype.setFullYear = function(y) {
1883
+ var d = new CalendarDateObject(this);
1884
  d.__msh_oldSetFullYear(y);
1885
  if (d.getMonth() != this.getMonth())
1886
  this.setDate(28);
1887
  this.__msh_oldSetFullYear(y);
1888
  };
1889
 
1890
+ CalendarDateObject.prototype = new Date();
1891
+ CalendarDateObject.prototype.constructor = CalendarDateObject;
1892
+ CalendarDateObject.prototype.parent = Date.prototype;
1893
+ function CalendarDateObject() {
1894
+ var dateObj;
1895
+ if (arguments.length > 1) {
1896
+ dateObj = eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");");
1897
+ } else if (arguments.length > 0) {
1898
+ dateObj = new this.parent.constructor(arguments[0]);
1899
+ } else {
1900
+ dateObj = new this.parent.constructor();
1901
+ if (typeof(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS) != "undefined") {
1902
+ dateObj.setTime(dateObj.getTime()+(CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS - dateObj.getTimezoneOffset())*1000);
1903
+ }
1904
+ }
1905
+ return dateObj;
1906
+ }
1907
+
1908
  // END: DATE OBJECT PATCHES
1909
 
1910
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Calendar</name>
4
- <version>1.3.1</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Calendar for Magento</summary>
10
  <description>Javascript Calendar for Magento</description>
11
- <notes>1.3.1</notes>
12
  <authors><author><name>Magento Core Team</name><user>auto-converted</user><email>core@magentocommerce.com</email></author></authors>
13
- <date>2009-04-17</date>
14
- <time>23:41:43</time>
15
- <contents><target name="mageweb"><dir name="js"><dir name="calendar"><dir name="skins"><dir name="aqua"><file name="active-bg.gif" hash="f8fb9f2b7428c94b41320aa1bc9cf601"/><file name="dark-bg.gif" hash="949f6a11667cbdfbb96f8986464ba81b"/><file name="hover-bg.gif" hash="803ac4dbc56c05739f515d6ac6a66163"/><file name="menuarrow.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/><file name="normal-bg.gif" hash="851134e42206fd3b173a3db654981bb6"/><file name="rowhover-bg.gif" hash="c097de7289bcf68723e89c248b9a2749"/><file name="status-bg.gif" hash="123882ca533030f07ee55c3818fc46b9"/><file name="theme.css" hash="ec69465f70d45213258fe1f89c52eceb"/><file name="title-bg.gif" hash="8d652fc5b683706fcbbf1103131c6ac2"/><file name="today-bg.gif" hash="9befc7d912cad22ddf2ec3fc21188bfd"/></dir></dir><file name="calendar-blue.css" hash="b8bb29e3c1573d0d2917cd3112b5052d"/><file name="calendar-blue2.css" hash="654dfacebcdd70c75ccaf2b4aee2d059"/><file name="calendar-brown.css" hash="f326a6a84037e549a9cd71a92346f210"/><file name="calendar-green.css" hash="b44e2c25ff56efaa6e37d84df202e5d5"/><file name="calendar-setup.js" hash="1bd1051973ea17f452fd8fe966940452"/><file name="calendar-system.css" hash="9b446e2ee0e9e4420fce20922405cec7"/><file name="calendar-tas.css" hash="fa3baa9367504954ef03c1f05d44f1a6"/><file name="calendar-win2k-1.css" hash="e3c61212e6abc28844005381d8fe9690"/><file name="calendar-win2k-2.css" hash="332d8bc7dab6acd575dba49a15b62947"/><file name="calendar-win2k-cold-1.css" hash="b0810ce949e6c954c54053c52b21e74a"/><file name="calendar-win2k-cold-2.css" hash="3487ec4e054141057673d794ce6d1032"/><file name="calendar.js" hash="45876c4994a8102c77940ef6e1cf9cdf"/><file name="img.gif" hash="c1e5255bd358fcd5a0779a0cc310a2fe"/><file name="menuarrow.gif" hash="b5a91d7a2755198b2eb729541ad3288c"/><file name="menuarrow2.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Mage_Pear_Helpers</name><channel>community</channel><min>1.0.18800</min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Lib_Js_Calendar</name>
4
+ <version>1.3.2</version>
5
  <stability>stable</stability>
6
  <license>Mixed</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Javascript Calendar for Magento</summary>
10
  <description>Javascript Calendar for Magento</description>
11
+ <notes>1.3.2</notes>
12
  <authors><author><name>Magento Core Team</name><user>auto-converted</user><email>core@magentocommerce.com</email></author></authors>
13
+ <date>2009-05-29</date>
14
+ <time>18:42:21</time>
15
+ <contents><target name="mageweb"><dir name="js"><dir name="calendar"><dir name="skins"><dir name="aqua"><file name="active-bg.gif" hash="f8fb9f2b7428c94b41320aa1bc9cf601"/><file name="dark-bg.gif" hash="949f6a11667cbdfbb96f8986464ba81b"/><file name="hover-bg.gif" hash="803ac4dbc56c05739f515d6ac6a66163"/><file name="menuarrow.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/><file name="normal-bg.gif" hash="851134e42206fd3b173a3db654981bb6"/><file name="rowhover-bg.gif" hash="c097de7289bcf68723e89c248b9a2749"/><file name="status-bg.gif" hash="123882ca533030f07ee55c3818fc46b9"/><file name="theme.css" hash="ec69465f70d45213258fe1f89c52eceb"/><file name="title-bg.gif" hash="8d652fc5b683706fcbbf1103131c6ac2"/><file name="today-bg.gif" hash="9befc7d912cad22ddf2ec3fc21188bfd"/></dir></dir><file name="calendar-blue.css" hash="b8bb29e3c1573d0d2917cd3112b5052d"/><file name="calendar-blue2.css" hash="654dfacebcdd70c75ccaf2b4aee2d059"/><file name="calendar-brown.css" hash="f326a6a84037e549a9cd71a92346f210"/><file name="calendar-green.css" hash="b44e2c25ff56efaa6e37d84df202e5d5"/><file name="calendar-setup.js" hash="1bd1051973ea17f452fd8fe966940452"/><file name="calendar-system.css" hash="9b446e2ee0e9e4420fce20922405cec7"/><file name="calendar-tas.css" hash="fa3baa9367504954ef03c1f05d44f1a6"/><file name="calendar-win2k-1.css" hash="e3c61212e6abc28844005381d8fe9690"/><file name="calendar-win2k-2.css" hash="332d8bc7dab6acd575dba49a15b62947"/><file name="calendar-win2k-cold-1.css" hash="b0810ce949e6c954c54053c52b21e74a"/><file name="calendar-win2k-cold-2.css" hash="3487ec4e054141057673d794ce6d1032"/><file name="calendar.js" hash="9bd3d66fb1226c4c1d6e9fde9fbb1294"/><file name="img.gif" hash="c1e5255bd358fcd5a0779a0cc310a2fe"/><file name="menuarrow.gif" hash="b5a91d7a2755198b2eb729541ad3288c"/><file name="menuarrow2.gif" hash="1f8c673c8f76832febaeeac88a5f4353"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><package><name>Mage_Pear_Helpers</name><channel>community</channel><min>1.0.18800</min><max></max></package></required></dependencies>
18
  </package>