@datarailsshared/dr_renderer 1.5.90 → 1.5.94

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.5.90",
3
+ "version": "1.5.94",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -9536,7 +9536,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9536
9536
  lodash.forEach(values, (value, key) => {
9537
9537
  const formatInfo = pivotData[type][key] || {};
9538
9538
  const valueToFloat = parseFloat(value);
9539
- const isDate = formatInfo.type === 'Date' && (moment_lib(valueToFloat).isValid() || moment_lib(value).isValid());
9539
+ const isDate = formatInfo.type === 'Date' && (moment_lib(valueToFloat).isValid() || moment_lib(value, formatInfo.format).isValid());
9540
9540
  const isDateFormatting = isDate && highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
9541
9541
  const isNumberFormatting = !isDate && formatInfo.format && highchartsRenderer.isFormattingNumberAxis(pivotData);
9542
9542
 
@@ -5160,6 +5160,17 @@ describe('highcharts_renderer', () => {
5160
5160
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
5161
5161
  expect(formattedKey).toEqual(initialKey);
5162
5162
  });
5163
+
5164
+ it('should return formatted value when type is Date and value is a valid moment date (with valid format)', () => {
5165
+ const initialKey = ['Q4-20'];
5166
+ const pivotData = {
5167
+ colFormats: [{ format: "[Q]Q-YY", name: "Date", type: "Date" }],
5168
+ isFormattingAxisLabels: true,
5169
+ };
5170
+ const type = 'colFormats';
5171
+ const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
5172
+ expect(formattedKey).toEqual(initialKey);
5173
+ });
5163
5174
  });
5164
5175
  });
5165
5176