Prerequisites
Product version - 10.4.0 Product type (Angular or MVC)?Angular Product framework type (.net framework or .net core)? .NetCore ABP Framework version? ABP 6.4
Hi Support Team,
I am using a Devextreme component in my application. Its a DateTime picker. Something like in this page https://js.devexpress.com/Demos/WidgetsGallery/Demo/DateBox/Overview/jQuery/Light/ But it is not working properly. When I checked with them, they asked me to make sure that the Date.prototype methods are not overwritten in the project. In my project I see the following code in AppPrebootstrap.ts
private static configureLuxon() {
let luxonLocale = new LocaleMappingService().map(
'luxon',
abp.localization.currentLanguage.name
);
DateTime.local().setLocale(luxonLocale);
DateTime.utc().setLocale(luxonLocale);
if (abp.clock.provider.supportsMultipleTimezone) {
Settings.defaultZoneName = abp.timing.timeZoneInfo.iana.timeZoneId;
}
Date.prototype.toISOString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
Date.prototype.toString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
DateTime.prototype.toString = function () {
let date = this.setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId) as DateTime;
return date.toISO();
};
locale(abp.localization.currentLanguage.name);
}
Can you please let me know why the prototype classes are overridden in the above function? I tried commenting the following lines but did not see any changes in the application.
Date.prototype.toISOString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
Date.prototype.toString = function () {
let value = DateTime.fromJSDate(this).setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId).toString();
return value;
};
DateTime.prototype.toString = function () {
let date = this.setLocale('en').setZone(abp.timing.timeZoneInfo.iana.timeZoneId) as DateTime;
return date.toISO();
};
Regards
1 Answer(s)
-
0
Hi,
Could you apply the workaround explained in https://github.com/aspnetzero/aspnet-zero-core/issues/3938#issue-909349522 ?