In SmartClient version 5.6, fields of type "Time" are stored as date objects, with the time set in the local timezone of the browser.
This means time field values may appear differently when accessed from browsers with different local time-zones.
This is a patch to store times consistently as UTC times, resolving this discrepancy in accessing stored times from different local time-zones.
Note: If you have legacy data including time-fields, and your dates are stored in some other time-zone, the class-property isc.Time.UTCHoursOffset may be set to the offset between your stored data and UTC.
This patch applies to the 5.6 Evaluation builds only.
This means time field values may appear differently when accessed from browsers with different local time-zones.
This is a patch to store times consistently as UTC times, resolving this discrepancy in accessing stored times from different local time-zones.
Note: If you have legacy data including time-fields, and your dates are stored in some other time-zone, the class-property isc.Time.UTCHoursOffset may be set to the offset between your stored data and UTC.
This patch applies to the 5.6 Evaluation builds only.
Code:
//---------------------------------------------------------------------------- // Isomorphic SmartClient v5.6 patch // Purpose: Normalize all time strings to UTC time for consistent storage / display across // client time-zones. // Note: For legacy data stored with desired time not represented in UTC, // the 'UTCHoursOffset' class property may be specified to the number of hours // the stored data's timezone differs from UTC. //---------------------------------------------------------------------------- if (window.isc && (isc.version == "5.6/SDK Development Only" || isc.version == "5.6/EVAL Deployment")) { isc.Time.addClassProperties({ UTCHoursOffset:0, format:function(_1,_2,_3){if(!isc.isA.Date(_1))return _1;var _4=_2;if(!_2&&!isc.isA.String(_2)&&!isc.isA.Function(_2)){_2=_3?this.shortDisplayFormat:this.displayFormat} if(isc.isA.Function(_2))return _2(_1);if(isc.isA.String(_2))_2=this.formatterMap[_2];if(!isc.isAn.Object(_2)){this.logWarn("Invalid time formatter:"+_4+" - using 'toTime'"); _2=this.formatterMap.toTime} var _5=_2.showSeconds,_6=_2.padded,_7=_2.show24;var _8=_1.getUTCHours();_8 -= isc.Time.UTCHoursOffset;var _9=_1.getUTCMinutes(),_10=_5?_1.getUTCSeconds():null, _11=_7?null:(_8>=12);if(!_7){if(_8>12)_8=_8-12;if(_8==0)_8=12}if(_6)_8=_8.stringify(2);var _12=_5?this.$hf:this.$hg; _12[0]=_8;_12[2]=_9.stringify();if(_5)_12[4]=_10.stringify();if(!_7)_12[5]=(_11?this.PMIndicator:this.AMIndicator);else _12[5]=null; return _12.join(isc.emptyString)}, parseInput:function(_1,_2){var _3=0,_4=0,_5=0;if(isc.isA.Date(_1)){_3=_1.getUTCHours();_3-=isc.Time.UTCHoursOffset; _4=_1.getUTCMinutes();_5=_1.getUTCSeconds() }else if(_1){for(var i=0;i<isc.Time.$he.length;i++){var _7=isc.Time.$he[i].exec(_1);if(_7)break} if(_7){var _3=Math.min(parseInt(_7[1]|0,10),23),_4=Math.min(parseInt(_7[2]|0,10),59),_5=Math.min(parseInt(_7[3]|0,10),59),_8=_7[4];; if(_8){if(!this.$hh)this.$hh={p:true,P:true,pm:true,PM:true,Pm:true};if(this.$hh[_8]){if(_3<12)_3+=12}else if(_3==12)_3=0}}else if(_2)return null }else if(_2)return null;var _9=new Date();_3 += isc.Time.UTCHoursOffset;_9.setUTCHours(_3);_9.setUTCMinutes(_4);_9.setUTCSeconds(_5);return _9} }) } else if (window.isc) isc.Log.logWarn("SmartClient 5.6 Evaluation build patch code included in this application. You are running build version:" + isc.version + ". This patch code will have no effect on this build and should be removed. Contact Isomorphic Software directly for more information on this issue"); //---------------------------------------------------------------------------- // End of patch //----------------------------------------------------------------------------