After i upgrade Umbraco CMS from version 7.4.0 to 7.12.4. I found out that every date picker gives this dateVal.locale is not a function error.
umbraco.services.js where the error is from.
angular.module('umbraco.services').factory('versionHelper', versionHelper);
function dateHelper() {
return {
convertToServerStringTime: function (momentLocal, serverOffsetMinutes, format) {
//get the formatted offset time in HH:mm (server time offset is in minutes)
var formattedOffset = (serverOffsetMinutes > 0 ? '+' : '-') + moment().startOf('day').minutes(Math.abs(serverOffsetMinutes)).format('HH:mm');
var server = moment.utc(momentLocal).utcOffset(formattedOffset);
return server.format(format ? format : 'YYYY-MM-DD HH:mm:ss');
},
convertToLocalMomentTime: function (strVal, serverOffsetMinutes) {
//get the formatted offset time in HH:mm (server time offset is in minutes)
var formattedOffset = (serverOffsetMinutes > 0 ? '+' : '-') + moment().startOf('day').minutes(Math.abs(serverOffsetMinutes)).format('HH:mm');
//if the string format already denotes that it's in "Roundtrip UTC" format (i.e. "2018-02-07T00:20:38.173Z")
//otherwise known as https://en.wikipedia.org/wiki/ISO_8601. This is the default format returned from the server
//since that is the default formatter for newtonsoft.json. When it is in this format, we need to tell moment
//to load the date as UTC so it's not changed, otherwise load it normally
var isoFormat;
if (strVal.indexOf('T') > -1 && strVal.endsWith('Z')) {
isoFormat = moment.utc(strVal).format('YYYY-MM-DDTHH:mm:ss') + formattedOffset;
} else {
isoFormat = moment(strVal).format('YYYY-MM-DDTHH:mm:ss') + formattedOffset;
}
//create a moment with the iso format which will include the offset with the correct time
// then convert it to local time
return moment.parseZone(isoFormat).local();
},
getLocalDate: function (date, culture, format) {
if (date) {
var dateVal;
var serverOffset = Umbraco.Sys.ServerVariables.application.serverTimeOffset;
var localOffset = new Date().getTimezoneOffset();
var serverTimeNeedsOffsetting = -serverOffset !== localOffset;
if (serverTimeNeedsOffsetting) {
dateVal = this.convertToLocalMomentTime(date, serverOffset);
} else {
dateVal = moment(date, 'YYYY-MM-DD HH:mm:ss');
}
return dateVal.locale(culture).format(format); // <-- THIS LINE
}
}
};
}
umbraco.directives.js where the service is called.
dateVal.locale is not a function
Hey all.
After i upgrade Umbraco CMS from version 7.4.0 to 7.12.4. I found out that every date picker gives this dateVal.locale is not a function error.
umbraco.services.js where the error is from.
umbraco.directives.js where the service is called.
I have tried to replace the the folder umbraco and umbraco_client with a clean 7.12.4 package, with no luck. Am i missing something obvious?
When i read my own message for the 15th time. I think it might be something to do with the created date on a document and not the date picker it self.
is working on a reply...