@datarailsshared/dr_renderer 1.2.408 → 1.2.410
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -5165,10 +5165,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5165
5165
|
else if (format == 'week')
|
5166
5166
|
return highchartsRenderer.returnRawDataWeekValue(tryParse);
|
5167
5167
|
|
5168
|
-
format =
|
5169
|
-
format = format.replace('yyyy', 'YYYY');
|
5170
|
-
format = format.replace('yy', 'YY');
|
5171
|
-
format = lodash.replace(format, /h/g, 'H');
|
5168
|
+
format = highchartsRenderer.adjustFormatToSupportedByMoment(format);
|
5172
5169
|
|
5173
5170
|
const timeframe = highchartsRenderer.getTimeframeByFormat(format);
|
5174
5171
|
const fiscalYearMonthsModifier = highchartsRenderer.getFiscalYearMonthModifier();
|
@@ -8543,8 +8540,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8543
8540
|
const fiscalYearMonthsModifier = highchartsRenderer.getFiscalYearMonthModifier();
|
8544
8541
|
|
8545
8542
|
if (format) {
|
8546
|
-
format =
|
8547
|
-
format = format.replace(/d/g, 'D');
|
8543
|
+
format = highchartsRenderer.adjustFormatToSupportedByMoment(format);
|
8548
8544
|
} else if (colName === 'VT_Month') {
|
8549
8545
|
format = 'MMM YYYY';
|
8550
8546
|
}
|
@@ -9429,7 +9425,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9429
9425
|
if (aggregationConfig && aggregationConfig.aggregate_by && aggregationConfig.is_formatting_by_aggregation_method) {
|
9430
9426
|
return highchartsRenderer.getDateFormatByTimeframe(aggregationConfig.aggregate_by, dateField.format);
|
9431
9427
|
}
|
9432
|
-
return dateField.format;
|
9428
|
+
return highchartsRenderer.adjustFormatToSupportedByMoment(dateField.format);
|
9433
9429
|
}
|
9434
9430
|
|
9435
9431
|
highchartsRenderer.getDateFormatByTimeframe = function(timeframe, defaultDateFormat) {
|
@@ -9808,6 +9804,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9808
9804
|
disableAnimation = disabled;
|
9809
9805
|
};
|
9810
9806
|
|
9807
|
+
highchartsRenderer.adjustFormatToSupportedByMoment = function(format) {
|
9808
|
+
return typeof format === 'string'
|
9809
|
+
? format.replace(/y/g, 'Y').replace(/d/g, 'D').replace(/h/g, 'H')
|
9810
|
+
: format;
|
9811
|
+
}
|
9812
|
+
|
9811
9813
|
return highchartsRenderer;
|
9812
9814
|
};
|
9813
9815
|
|
@@ -4551,14 +4551,14 @@ describe('highcharts_renderer', () => {
|
|
4551
4551
|
|
4552
4552
|
dateField = {
|
4553
4553
|
id: 1,
|
4554
|
-
format: '%
|
4554
|
+
format: '%y-%m-%d',
|
4555
4555
|
};
|
4556
4556
|
});
|
4557
4557
|
|
4558
|
-
it('returns format
|
4558
|
+
it('returns field format adjusted to moment when there is no aggregation config', () => {
|
4559
4559
|
widget.options.date_aggregation_configs = [];
|
4560
4560
|
const result = highchartsRenderer.getDateFieldFormat(widget, dateField);
|
4561
|
-
expect(result).toEqual('%Y-%m-%
|
4561
|
+
expect(result).toEqual('%Y-%m-%D');
|
4562
4562
|
});
|
4563
4563
|
|
4564
4564
|
it('returns format by time frame when there is an aggregation config', () => {
|
@@ -4566,10 +4566,10 @@ describe('highcharts_renderer', () => {
|
|
4566
4566
|
expect(result).toEqual('[Q]Q-YY');
|
4567
4567
|
});
|
4568
4568
|
|
4569
|
-
it('returns format
|
4569
|
+
it('returns field format adjusted to moment when there is an aggregation config but no time frame specified', () => {
|
4570
4570
|
widget.options.date_aggregation_configs[0].aggregate_by = null;
|
4571
4571
|
const result = highchartsRenderer.getDateFieldFormat(widget, dateField);
|
4572
|
-
expect(result).toEqual('%Y-%m-%
|
4572
|
+
expect(result).toEqual('%Y-%m-%D');
|
4573
4573
|
});
|
4574
4574
|
});
|
4575
4575
|
|