Fix date.toLocaleString for invalid language
This commit is contained in:
parent
e249c54bdb
commit
fc154f4923
|
@ -1525,8 +1525,15 @@ define([
|
||||||
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
||||||
if (this.coreProps) {
|
if (this.coreProps) {
|
||||||
var value = this.coreProps.asc_getCreated();
|
var value = this.coreProps.asc_getCreated();
|
||||||
if (value)
|
if (value) {
|
||||||
this.lblDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
this._ShowHideInfoItem(this.lblDate, !!value);
|
this._ShowHideInfoItem(this.lblDate, !!value);
|
||||||
} else if (pdfProps)
|
} else if (pdfProps)
|
||||||
this.updatePdfInfo(pdfProps);
|
this.updatePdfInfo(pdfProps);
|
||||||
|
@ -1544,8 +1551,16 @@ define([
|
||||||
if (props) {
|
if (props) {
|
||||||
var visible = false;
|
var visible = false;
|
||||||
value = props.asc_getModified();
|
value = props.asc_getModified();
|
||||||
if (value)
|
|
||||||
this.lblModifyDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
if (value) {
|
||||||
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
||||||
value = props.asc_getLastModifiedBy();
|
value = props.asc_getLastModifiedBy();
|
||||||
if (value)
|
if (value)
|
||||||
|
@ -1586,7 +1601,13 @@ define([
|
||||||
value = props.CreationDate;
|
value = props.CreationDate;
|
||||||
if (value) {
|
if (value) {
|
||||||
value = new Date(value);
|
value = new Date(value);
|
||||||
this.lblDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._ShowHideInfoItem(this.lblDate, !!value);
|
this._ShowHideInfoItem(this.lblDate, !!value);
|
||||||
|
|
||||||
|
@ -1594,7 +1615,13 @@ define([
|
||||||
value = props.ModDate;
|
value = props.ModDate;
|
||||||
if (value) {
|
if (value) {
|
||||||
value = new Date(value);
|
value = new Date(value);
|
||||||
this.lblModifyDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
||||||
visible = this._ShowHideInfoItem(this.lblModifyBy, false) || visible;
|
visible = this._ShowHideInfoItem(this.lblModifyBy, false) || visible;
|
||||||
|
|
|
@ -1215,8 +1215,15 @@ define([
|
||||||
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
||||||
if (this.coreProps) {
|
if (this.coreProps) {
|
||||||
var value = this.coreProps.asc_getCreated();
|
var value = this.coreProps.asc_getCreated();
|
||||||
if (value)
|
if (value) {
|
||||||
this.lblDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
this._ShowHideInfoItem(this.lblDate, !!value);
|
this._ShowHideInfoItem(this.lblDate, !!value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1241,8 +1248,15 @@ define([
|
||||||
if (props) {
|
if (props) {
|
||||||
var visible = false;
|
var visible = false;
|
||||||
value = props.asc_getModified();
|
value = props.asc_getModified();
|
||||||
if (value)
|
if (value) {
|
||||||
this.lblModifyDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
||||||
value = props.asc_getLastModifiedBy();
|
value = props.asc_getLastModifiedBy();
|
||||||
if (value)
|
if (value)
|
||||||
|
|
|
@ -1945,12 +1945,19 @@ define([
|
||||||
case Asc.c_oAscError.ID.FillAllRowsWarning:
|
case Asc.c_oAscError.ID.FillAllRowsWarning:
|
||||||
var fill = errData[0],
|
var fill = errData[0],
|
||||||
have = errData[1],
|
have = errData[1],
|
||||||
fillWithSeparator = fill.toLocaleString(this.appOptions.lang);
|
lang = (this.appOptions.lang || 'en').replace('_', '-').toLowerCase(),
|
||||||
|
fillWithSeparator;
|
||||||
|
try {
|
||||||
|
fillWithSeparator = fill.toLocaleString(lang);
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
fillWithSeparator = fill.toLocaleString(lang);
|
||||||
|
}
|
||||||
if (this.appOptions.isDesktopApp && this.appOptions.isOffline) {
|
if (this.appOptions.isDesktopApp && this.appOptions.isOffline) {
|
||||||
config.msg = fill > have ? Common.Utils.String.format(this.textFormulaFilledAllRowsWithEmpty, fillWithSeparator) : Common.Utils.String.format(this.textFormulaFilledAllRows, fillWithSeparator);
|
config.msg = fill > have ? Common.Utils.String.format(this.textFormulaFilledAllRowsWithEmpty, fillWithSeparator) : Common.Utils.String.format(this.textFormulaFilledAllRows, fillWithSeparator);
|
||||||
config.buttons = [{caption: this.textFillOtherRows, primary: true, value: 'fillOther'}, 'close'];
|
config.buttons = [{caption: this.textFillOtherRows, primary: true, value: 'fillOther'}, 'close'];
|
||||||
} else {
|
} else {
|
||||||
config.msg = fill >= have ? Common.Utils.String.format(this.textFormulaFilledFirstRowsOtherIsEmpty, fillWithSeparator) : Common.Utils.String.format(this.textFormulaFilledFirstRowsOtherHaveData, fillWithSeparator, (have - fill).toLocaleString(this.appOptions.lang));
|
config.msg = fill >= have ? Common.Utils.String.format(this.textFormulaFilledFirstRowsOtherIsEmpty, fillWithSeparator) : Common.Utils.String.format(this.textFormulaFilledFirstRowsOtherHaveData, fillWithSeparator, (have - fill).toLocaleString(lang));
|
||||||
config.buttons = ['ok'];
|
config.buttons = ['ok'];
|
||||||
}
|
}
|
||||||
config.maxwidth = 400;
|
config.maxwidth = 400;
|
||||||
|
|
|
@ -1590,8 +1590,15 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||||
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
this.coreProps = (this.api) ? this.api.asc_getCoreProps() : null;
|
||||||
if (this.coreProps) {
|
if (this.coreProps) {
|
||||||
var value = this.coreProps.asc_getCreated();
|
var value = this.coreProps.asc_getCreated();
|
||||||
if (value)
|
if (value) {
|
||||||
this.lblDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
this._ShowHideInfoItem(this.lblDate, !!value);
|
this._ShowHideInfoItem(this.lblDate, !!value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1616,8 +1623,15 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||||
if (props) {
|
if (props) {
|
||||||
var visible = false;
|
var visible = false;
|
||||||
value = props.asc_getModified();
|
value = props.asc_getModified();
|
||||||
if (value)
|
if (value) {
|
||||||
this.lblModifyDate.text(value.toLocaleString(this.mode.lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(this.mode.lang, {timeStyle: 'short'}));
|
var lang = (this.mode.lang || 'en').replace('_', '-').toLowerCase();
|
||||||
|
try {
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
} catch (e) {
|
||||||
|
lang = 'en';
|
||||||
|
this.lblModifyDate.text(value.toLocaleString(lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleString(lang, {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
}
|
||||||
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
visible = this._ShowHideInfoItem(this.lblModifyDate, !!value) || visible;
|
||||||
value = props.asc_getLastModifiedBy();
|
value = props.asc_getLastModifiedBy();
|
||||||
if (value)
|
if (value)
|
||||||
|
|
Loading…
Reference in a new issue