@sis-cc/dotstatsuite-components 14.2.1 → 14.2.2
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.
|
@@ -43,8 +43,10 @@ var getReportingYearStart = exports.getReportingYearStart = function getReportin
|
|
|
43
43
|
|
|
44
44
|
var _R$match = R.match(/[\d]{2}/g, reportYearStart),
|
|
45
45
|
_R$match2 = (0, _slicedToArray3.default)(_R$match, 2),
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
_R$match2$ = _R$match2[0],
|
|
47
|
+
month = _R$match2$ === undefined ? '01' : _R$match2$,
|
|
48
|
+
_R$match2$2 = _R$match2[1],
|
|
49
|
+
day = _R$match2$2 === undefined ? '01' : _R$match2$2;
|
|
48
50
|
|
|
49
51
|
return { month: month, day: day };
|
|
50
52
|
};
|
package/package.json
CHANGED
|
@@ -11,6 +11,6 @@ export const getReportingYearStart = (sdmxJson) => {
|
|
|
11
11
|
return id === REPORTING_YEAR_START_DAY || id === REPYEARSTART;
|
|
12
12
|
}, attributes) || {};
|
|
13
13
|
const reportYearStart = R.pathOr('--01-01', ['values', 0, 'name'], reportYearStartAttr);
|
|
14
|
-
const [month, day] = R.match(/[\d]{2}/g, reportYearStart);
|
|
14
|
+
const [month = '01', day = '01'] = R.match(/[\d]{2}/g, reportYearStart);
|
|
15
15
|
return ({ month, day });
|
|
16
16
|
};
|
|
@@ -5,6 +5,22 @@ describe('getReportingYearStart tests', () => {
|
|
|
5
5
|
it('no data', () => {
|
|
6
6
|
expect(getReportingYearStart()).to.deep.equal({ month: '01', day: '01' });
|
|
7
7
|
});
|
|
8
|
+
it('unexpected data in REPYEARSTART attr: "0"', () => {
|
|
9
|
+
const data = {
|
|
10
|
+
data: {
|
|
11
|
+
structure: {
|
|
12
|
+
attributes: {
|
|
13
|
+
observation: [
|
|
14
|
+
{ "id": "REPYEARSTART",
|
|
15
|
+
"values": [{ "name": "0", "names": { "en": "0" } }]
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
expect(getReportingYearStart(data)).to.deep.equal({ month: '01', day: '01' });
|
|
23
|
+
});
|
|
8
24
|
it('REPORTING_YEAR_START_DAY', () => {
|
|
9
25
|
const dataReportingYearStartDay = {
|
|
10
26
|
data: {
|