Hi Isomorphic,
We just upgraded our front-end to SmartClient_SC_SNAPSHOT-2011-11-24_LGPL (v8.1 from 8.0) recently.
Everything seems to be fine except the dates handling. Before updating, using DatePickers (fields of type 'date') we used to get dates formatted like 'MM/DD/YYYY'... After the upgrade we started getting dates formatted like 'MM/DD/YYYY 12:00:00' which breaks our entire date handling across the app.
Here is an excerpt of the way we set dates:
As you can see we determine whether a date is dateTime by looking into the getHours(), getMinutes().... methods.
Any insights on that?
Thank you in advance,
We just upgraded our front-end to SmartClient_SC_SNAPSHOT-2011-11-24_LGPL (v8.1 from 8.0) recently.
Everything seems to be fine except the dates handling. Before updating, using DatePickers (fields of type 'date') we used to get dates formatted like 'MM/DD/YYYY'... After the upgrade we started getting dates formatted like 'MM/DD/YYYY 12:00:00' which breaks our entire date handling across the app.
Here is an excerpt of the way we set dates:
Code:
//-------------------------------------------------------------------------------------------------------------------------------- // Set global date formatting rules //-------------------------------------------------------------------------------------------------------------------------------- Date.setShortDisplayFormat(DateUtils.getUiFormatDateString); Date.setNormalDisplayFormat(DateUtils.getUiFormatDateString); Date.setInputFormat('MDY'); var DateUtils = isc.defineClass("DateUtils", "Class"); DateUtils.addClassProperties ({ //-------------------------------------------------------------------------------------------------------------------------------- /** * Returns the UI date string representation of a given date object. Returns null if supplied object is not a date object. * * @param {Date} date Date for which to obtain the UI representation * @param {String} dateTimeDelimiter Will be added between the date and time portion of UI representation * @return {String} UI string representation for given date */ //---------------------------------------------------------------------------------------------------------------------------- getUiFormatDateString : function(date, dateTimeDelimiter) { if (this != null && isA.Date(this)) date = this; return DateUtils.getFormattedDate(date, dateTimeDelimiter); }, //---------------------------------------------------------------------------------------------------------------------------- /** * Returns a formatted string representation of a given date object. * @param {Date} date Date for which to obtain the ANSI representation * @param {String} dateTimeDelimiter Will be added between the date and time portion of the formatted representation * @return {String} Ansi string representation for given date */ //---------------------------------------------------------------------------------------------------------------------------- getFormattedDate : function(date, dateTimeDelimiter) { if (dateTimeDelimiter == undefined) dateTimeDelimiter = ' '; if (!isA.Date(date)) return null; var strYear = '' + date.getFullYear(); var strMonth = '' + (date.getMonth() + 1); if (strMonth.length != 2) strMonth = '0' + strMonth; var strDay = '' + date.getDate(); if (strDay.length != 2) strDay = '0' + strDay; var strDate; strDate = strMonth + '/' + strDay + '/' + strYear; if (DateUtils.isDateTime(date)) { var strHours = '' + date.getHours(); var strMinutes = '' + date.getMinutes(); var strSeconds = '' + date.getSeconds(); strDate += dateTimeDelimiter; if (strHours.length < 2) strDate += '0'; strDate += strHours; strDate += ":"; if (strMinutes.length < 2) strDate += '0'; strDate += strMinutes; strDate += ":"; if (strSeconds.length < 2) strDate += '0'; strDate += strSeconds; } return strDate; }, //-------------------------------------------------------------------------------------------------------------------------------- /** * Returns whether a date object is a date/time. Assumes a date/time as soon as one of the date's time components * is set to a non-zero value. * * @param {Date} date Date to evaluate * @return {Boolean} true when dateTime, false otherwise */ //---------------------------------------------------------------------------------------------------------------------------- isDateTime : function(date) { if (!isA.Date(date)) return false; return date.getHours() || date.getMinutes() || date.getSeconds() || date.getMilliseconds() ? true : false; } });
Any insights on that?
Thank you in advance,
Comment