Commit cb0b720a authored by konovalovsergey's avatar konovalovsergey

fix bug 31395

parent 8ac92461
...@@ -308,21 +308,7 @@ var editor; ...@@ -308,21 +308,7 @@ var editor;
if (cultureInfo) { if (cultureInfo) {
var numFormatDigit = AscCommon.oNumFormatCache.get('#,##0.00'); var numFormatDigit = AscCommon.oNumFormatCache.get('#,##0.00');
var dateElems = []; var formatDate = AscCommonExcel.getShortDateFormat(cultureInfo);
for (var i = 0; i < cultureInfo.ShortDatePattern.length; ++i) {
switch (cultureInfo.ShortDatePattern[i]) {
case '0':
dateElems.push('d');
break;
case '1':
dateElems.push('m');
break;
case '2':
dateElems.push('yyyy');
break;
}
}
var formatDate = dateElems.join('/');
formatDate += " h:mm"; formatDate += " h:mm";
if (cultureInfo.AMDesignator && cultureInfo.PMDesignator) { if (cultureInfo.AMDesignator && cultureInfo.PMDesignator) {
formatDate += " AM/PM"; formatDate += " AM/PM";
......
...@@ -4697,7 +4697,7 @@ ...@@ -4697,7 +4697,7 @@
if (null != sFormat) { if (null != sFormat) {
oRes = new AscCommonExcel.Num(); oRes = new AscCommonExcel.Num();
oRes.f = sFormat; oRes.f = sFormat;
if ((5 <= oNum.id && oNum.id <= 8) || (15 <= oNum.id && oNum.id <= 17) || (37 <= oNum.id && oNum.id <= 44)) { if ((5 <= oNum.id && oNum.id <= 8) || (14 <= oNum.id && oNum.id <= 17) || 22 == oNum.id || (27 <= oNum.id && oNum.id <= 31) || (36 <= oNum.id && oNum.id <= 44)) {
oRes.id = oNum.id; oRes.id = oNum.id;
} }
} }
......
...@@ -1061,6 +1061,18 @@ Num.prototype = ...@@ -1061,6 +1061,18 @@ Num.prototype =
case 8: case 8:
res = AscCommonExcel.getCurrencyFormatSimple(null, true, true, true); res = AscCommonExcel.getCurrencyFormatSimple(null, true, true, true);
break; break;
case 22:
res = AscCommonExcel.getShortDateFormat(null) + " h:mm";
break;
case 14:
case 27:
case 28:
case 29:
case 30:
case 31:
case 36:
res = AscCommonExcel.getShortDateFormat(null);
break;
case 37: case 37:
res = AscCommonExcel.getCurrencyFormatSimple(null, false, false, false); res = AscCommonExcel.getCurrencyFormatSimple(null, false, false, false);
break; break;
...@@ -6452,6 +6464,25 @@ AutoFilterDateElem.prototype.convertDateGroupItemToRange = function(oDateGroupIt ...@@ -6452,6 +6464,25 @@ AutoFilterDateElem.prototype.convertDateGroupItemToRange = function(oDateGroupIt
this.dateTimeGrouping = oDateGroupItem.DateTimeGrouping; this.dateTimeGrouping = oDateGroupItem.DateTimeGrouping;
}; };
function getShortDateFormat(opt_cultureInfo) {
var cultureInfo = opt_cultureInfo ? opt_cultureInfo : AscCommon.g_oDefaultCultureInfo;
var dateElems = [];
for (var i = 0; i < cultureInfo.ShortDatePattern.length; ++i) {
switch (cultureInfo.ShortDatePattern[i]) {
case '0':
dateElems.push('d');
break;
case '1':
dateElems.push('m');
break;
case '2':
dateElems.push('yyyy');
break;
}
}
return dateElems.join('/');
}
function getCurrencyFormatSimple(opt_cultureInfo, opt_fraction, opt_currency, opt_red) { function getCurrencyFormatSimple(opt_cultureInfo, opt_fraction, opt_currency, opt_red) {
var cultureInfo = opt_cultureInfo ? opt_cultureInfo : AscCommon.g_oDefaultCultureInfo; var cultureInfo = opt_cultureInfo ? opt_cultureInfo : AscCommon.g_oDefaultCultureInfo;
var numberFormat = opt_fraction ? '#,##0.00' : '#,##0'; var numberFormat = opt_fraction ? '#,##0.00' : '#,##0';
...@@ -6718,6 +6749,7 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr ...@@ -6718,6 +6749,7 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
window['AscCommonExcel'].DateGroupItem = DateGroupItem; window['AscCommonExcel'].DateGroupItem = DateGroupItem;
window['AscCommonExcel'].SortCondition = SortCondition; window['AscCommonExcel'].SortCondition = SortCondition;
window['AscCommonExcel'].AutoFilterDateElem = AutoFilterDateElem; window['AscCommonExcel'].AutoFilterDateElem = AutoFilterDateElem;
window['AscCommonExcel'].getShortDateFormat = getShortDateFormat;
window['AscCommonExcel'].getCurrencyFormatSimple = getCurrencyFormatSimple; window['AscCommonExcel'].getCurrencyFormatSimple = getCurrencyFormatSimple;
window['AscCommonExcel'].getCurrencyFormat = getCurrencyFormat; window['AscCommonExcel'].getCurrencyFormat = getCurrencyFormat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment