[open-ils-commits] r14966 - in trunk/Open-ILS/xul/staff_client/chrome/content: main util (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Nov 19 00:43:51 EST 2009
Author: phasefx
Date: 2009-11-19 00:43:47 -0500 (Thu, 19 Nov 2009)
New Revision: 14966
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
trunk/Open-ILS/xul/staff_client/chrome/content/util/date.js
Log:
Use Dojo for parsing date strings from the database into javascript date objects, and for turning dates into ISO8601 date strings. Stop using DP_DateExtensions.js. Add a {localized} format for util.date.formatted_date, using Dojo.
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-11-19 03:34:32 UTC (rev 14965)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js 2009-11-19 05:43:47 UTC (rev 14966)
@@ -283,8 +283,6 @@
'org_tree' : '/opac/common/js/' + LOCALE + '/OrgTree.js',
'browser' : '/opac/' + LOCALE + '/skin/default/xml/advanced.xml?nps=1',
'fieldmapper' : '/opac/common/js/fmall.js',
- 'isodate_lib_remote' : '/opac/common/js/DP_DateExtensions.js',
- 'isodate_lib_local' : 'chrome://open_ils_staff_client/content/OpenILS/util/DP_DateExtensions.js',
'xsl_marc2html' : '/opac/extras/xsl/oilsMARC21slim2HTML.xsl',
'AUDIO_GOOD_SOUND' : '/xul/server/skin/media/audio/bonus.wav',
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/date.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/date.js 2009-11-19 03:34:32 UTC (rev 14965)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/date.js 2009-11-19 05:43:47 UTC (rev 14966)
@@ -45,14 +45,9 @@
return( ms + 'ms (' + ms/1000 + 's)' );
}
-util.date.db_date2Date = function (date) {
- var y = date.substr(0,4);
- var mo = date.substr(5,2);
- var d = date.substr(8,2);
- var h = date.substr(11,2);
- var mi = date.substr(14,2);
- var s = date.substr(17,2);
- return new Date(y,mo-1,d,h,mi,s);
+util.date.db_date2Date = function (db_date) {
+ dojo.require('dojo.date.stamp');
+ return dojo.date.stamp.fromISOString( db_date );
}
util.date.formatted_date = function (orig_date,format) {
@@ -85,31 +80,13 @@
var M = _date.getMinutes(); M = M.toString(); if (M.length == 1) M = '0' + M;
var sec = _date.getSeconds(); sec = sec.toString(); if (sec.length == 1) sec = '0' + sec;
+ dojo.require('dojo.date.locale');
+ dojo.require('dojo.date.stamp');
+
var s = format;
if (s == '') { s = '%F %H:%M'; }
- if (typeof _date.iso8601Format != 'function') {
-
- try {
- var js = JSAN._loadJSFromUrl( urls.isodate_lib_remote );
- eval( js );
-
- } catch(E) {
-
- try {
- var js = JSAN._loadJSFromUrl( urls.isodate_lib_local );
- eval( js );
-
- } catch(F) {
-
- alert('Problem loading ISO8601 date extension:' + E + '\n' + F);
-
- }
- }
-
- }
- if (typeof _date.iso8601Format == 'function') {
- s = s.replace( /%\{iso8601\}/g, _date.iso8601Format("YMDHMS") );
- }
+ s = s.replace( /%\{localized\}/g, dojo.date.locale.format( _date ) );
+ s = s.replace( /%\{iso8601\}/g, dojo.date.stamp.toISOString( _date ) );
s = s.replace( /%m/g, mm );
s = s.replace( /%d/g, dd );
s = s.replace( /%Y/g, yyyy );
More information about the open-ils-commits
mailing list