From 9106176a3eb226c2683346ed80c17a84befdf377 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 26 Apr 2010 20:36:57 +0000 Subject: [PATCH] wire org unit settings for date/time formatting into util.date library git-svn-id: svn://svn.open-ils.org/ILS/trunk@16315 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/util/date.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/date.js b/Open-ILS/xul/staff_client/chrome/content/util/date.js index f0e3437877..c8a56eb805 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/date.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/date.js @@ -93,10 +93,21 @@ util.date.formatted_date = function (orig_date,format) { var s = format; if (s == '') { s = '%F %H:%M'; } if (typeof window.dojo != 'undefined') { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); dojo.require('dojo.date.locale'); dojo.require('dojo.date.stamp'); - s = s.replace( /%\{localized\}/g, dojo.date.locale.format( _date ) ); - s = s.replace( /%\{localized_date\}/g, dojo.date.locale.format( _date, { 'selector' : 'date' } ) ); + var dojo_format = {}; + var dojo_format2 = { 'selector' : 'date' }; + if (data.hash.aous['format.date']) { + dojo_format['datePattern'] = data.hash.aous['format.date']; + dojo_format2['datePattern'] = data.hash.aous['format.date']; + } + if (data.hash.aous['format.time']) { + dojo_format['timePattern'] = data.hash.aous['format.time']; + dojo_format2['timePattern'] = data.hash.aous['format.time']; + } + s = s.replace( /%\{localized\}/g, dojo.date.locale.format( _date, dojo_format ) ); + s = s.replace( /%\{localized_date\}/g, dojo.date.locale.format( _date, dojo_format2 ) ); s = s.replace( /%\{iso8601\}/g, dojo.date.stamp.toISOString( _date ) ); } s = s.replace( /%m/g, mm ); -- 2.11.0