@dhis2/analytics 29.3.0 → 29.3.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.
@@ -82,9 +82,11 @@ const PeriodTransfer = ({
82
82
  } else {
83
83
  const allFixed = (0, _fixedPeriods.getFixedPeriodsOptions)(periodsSettings);
84
84
  const allRelative = (0, _relativePeriods.getRelativePeriodsOptions)();
85
+ const v43PeriodTypes = [_index2.WEEKLYFRI, _index2.FYFEB, _index2.FYAUG, _index2.FYSEP];
86
+ const allExcludedPeriodTypes = [...excludedPeriodTypes, ...v43PeriodTypes];
85
87
  return {
86
- filteredFixedOptions: (0, _index2.filterPeriodTypesById)(allFixed, excludedPeriodTypes),
87
- filteredRelativeOptions: (0, _index2.filterPeriodTypesById)(allRelative, excludedPeriodTypes)
88
+ filteredFixedOptions: (0, _index2.filterPeriodTypesById)(allFixed, allExcludedPeriodTypes),
89
+ filteredRelativeOptions: (0, _index2.filterPeriodTypesById)(allRelative, allExcludedPeriodTypes)
88
90
  };
89
91
  }
90
92
  }, [supportsEnabledPeriodTypes, enabledPeriodTypesData, excludedPeriodTypes, periodsSettings]);
@@ -103,11 +105,11 @@ const PeriodTransfer = ({
103
105
  // use ".eraYear" rather than ".year" because in Ethiopian calendar, eraYear is what our users expect to see (for other calendars, it doesn't matter)
104
106
  // there is still a pending decision in Temporal regarding which era to use by default: https://github.com/js-temporal/temporal-polyfill/blob/9350ee7dd0d29f329fc097debf923a517c32f813/lib/calendar.ts#L1964
105
107
  const defaultFixedPeriodYear = now.eraYear || now.year;
106
- const fixedPeriodConfig = year => ({
108
+ const fixedPeriodConfig = (0, _react.useCallback)(year => ({
107
109
  offset: year - defaultFixedPeriodYear,
108
110
  filterFuturePeriods: false,
109
111
  reversePeriods: false
110
- });
112
+ }), [defaultFixedPeriodYear]);
111
113
  const [userPeriods, setUserPeriods] = (0, _react.useState)(null);
112
114
  const [isRelative, setIsRelative] = (0, _react.useState)(true);
113
115
  const [relativeFilter, setRelativeFilter] = (0, _react.useState)({
@@ -152,7 +154,7 @@ const PeriodTransfer = ({
152
154
  const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
153
155
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
154
156
  }
155
- }, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year]);
157
+ }, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year, fixedPeriodConfig]);
156
158
  const allPeriods = userPeriods !== null && userPeriods !== void 0 ? userPeriods : derivedPeriods;
157
159
  const isActive = value => {
158
160
  const item = selectedItems.find(item => item.id === value);
@@ -213,7 +215,7 @@ const PeriodTransfer = ({
213
215
  }, _DimensionSelectorStyle.default));
214
216
  const onSelectFixedPeriods = filter => {
215
217
  setFixedFilter(filter);
216
- if (filter.year.match(/[0-9]{4}/)) {
218
+ if (filter.year.match(/\d{4}/)) {
217
219
  const selectedOption = filteredFixedOptions.find(opt => opt.id === filter.periodType);
218
220
  setUserPeriods((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.getPeriods(fixedPeriodConfig(Number(filter.year)))) || []);
219
221
  }
@@ -8,7 +8,7 @@ describe('fixedPeriods utils', () => {
8
8
  describe('getOptions', () => {
9
9
  it('should return a list of available period ranges', () => {
10
10
  const periodIds = (0, _fixedPeriods.getFixedPeriodsOptions)().map(option => option.id);
11
- expect(periodIds).toEqual(['DAILY', 'WEEKLY', 'WEEKLYWED', 'WEEKLYTHU', 'WEEKLYSAT', 'WEEKLYSUN', 'BIWEEKLY', 'MONTHLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYOCT', 'FYNOV']);
11
+ expect(periodIds).toEqual(['DAILY', 'WEEKLY', 'WEEKLYWED', 'WEEKLYTHU', 'WEEKLYFRI', 'WEEKLYSAT', 'WEEKLYSUN', 'BIWEEKLY', 'MONTHLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYOCT', 'FYNOV']);
12
12
  });
13
13
  });
14
14
  describe('Daily period generator', () => {
@@ -8,7 +8,7 @@ describe('utils', () => {
8
8
  it('should filter fixed periods', () => {
9
9
  const excludedPeriodTypes = ['DAILY', 'WEEKLY', 'WEEKLYSAT', 'MONTHLY', 'FYOCT'];
10
10
  const periodIds = (0, _index.filterPeriodTypesById)((0, _fixedPeriods.getFixedPeriodsOptions)(), excludedPeriodTypes).map(option => option.id);
11
- expect(periodIds).toEqual(['WEEKLYWED', 'WEEKLYTHU', 'WEEKLYSUN', 'BIWEEKLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYNOV']);
11
+ expect(periodIds).toEqual(['WEEKLYWED', 'WEEKLYTHU', 'WEEKLYFRI', 'WEEKLYSUN', 'BIWEEKLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYNOV']);
12
12
  });
13
13
  it('should filter relative periods', () => {
14
14
  const excludedPeriodTypes = ['MONTHLY', 'BIMONTHLY'];
@@ -25,8 +25,10 @@ const v43Query = {
25
25
 
26
26
  // v43-only: analyticsFinancialYearStart is removed in v44
27
27
  const FY_SETTING_TO_SERVER_PT = {
28
+ FINANCIAL_YEAR_FEBRUARY: 'FinancialFeb',
28
29
  FINANCIAL_YEAR_APRIL: 'FinancialApril',
29
30
  FINANCIAL_YEAR_JULY: 'FinancialJuly',
31
+ FINANCIAL_YEAR_AUGUST: 'FinancialAug',
30
32
  FINANCIAL_YEAR_SEPTEMBER: 'FinancialSep',
31
33
  FINANCIAL_YEAR_OCTOBER: 'FinancialOct',
32
34
  FINANCIAL_YEAR_NOVEMBER: 'FinancialNov'
@@ -9,40 +9,48 @@ var _index = _interopRequireDefault(require("../../../locales/index.js"));
9
9
  var _index2 = require("./index.js");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  const PERIOD_TYPE_REGEX = exports.PERIOD_TYPE_REGEX = {
12
- [_index2.DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
12
+ [_index2.DAILY]: /^(\d{4})(\d{2})(\d{2})$/,
13
13
  // YYYYMMDD
14
- [_index2.WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/,
14
+ [_index2.WEEKLY]: /^(\d{4})W(\d{1,2})$/,
15
15
  // YYYY"W"[1-53]
16
- [_index2.BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/,
16
+ [_index2.BIWEEKLY]: /^(\d{4})BiW(\d{1,2})$/,
17
17
  // YYYY"BiW"[1-27]
18
- [_index2.WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/,
18
+ [_index2.WEEKLYWED]: /^(\d{4})(Wed)W(\d{1,2})$/,
19
19
  // YYYY"WedW"[1-53]
20
- [_index2.WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/,
20
+ [_index2.WEEKLYTHU]: /^(\d{4})(Thu)W(\d{1,2})$/,
21
21
  // YYYY"ThuW"[1-53]
22
- [_index2.WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/,
22
+ [_index2.WEEKLYFRI]: /^(\d{4})(Fri)W(\d{1,2})$/,
23
+ // YYYY"FriW"[1-53]
24
+ [_index2.WEEKLYSAT]: /^(\d{4})(Sat)W(\d{1,2})$/,
23
25
  // YYYY"SatW"[1-53]
24
- [_index2.WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/,
26
+ [_index2.WEEKLYSUN]: /^(\d{4})(Sun)W(\d{1,2})$/,
25
27
  // YYYY"SunW"[1-53]
26
- [_index2.MONTHLY]: /^([0-9]{4})([0-9]{2})$/,
28
+ [_index2.MONTHLY]: /^(\d{4})(\d{2})$/,
27
29
  // YYYYMM
28
- [_index2.BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/,
30
+ [_index2.BIMONTHLY]: /^(\d{4})(\d{2})B$/,
29
31
  // YYYY0[1-6]"B"
30
- [_index2.QUARTERLY]: /^([0-9]{4})Q([1234])$/,
32
+ [_index2.QUARTERLY]: /^(\d{4})Q([1234])$/,
31
33
  // YYYY"Q"[1-4]
32
- [_index2.SIXMONTHLY]: /^([0-9]{4})S([12])$/,
34
+ [_index2.SIXMONTHLY]: /^(\d{4})S([12])$/,
33
35
  // YYYY"S"[1/2]
34
- [_index2.SIXMONTHLYAPR]: /^([0-9]{4})AprilS([12])$/,
36
+ [_index2.SIXMONTHLYAPR]: /^(\d{4})AprilS([12])$/,
35
37
  // YYYY"AprilS"[1/2]
36
- // [SIXMONTHLYNOV]: /^([0-9]{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
37
- [_index2.YEARLY]: /^([0-9]{4})$/,
38
+ // [SIXMONTHLYNOV]: /^(\d{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
39
+ [_index2.YEARLY]: /^(\d{4})$/,
38
40
  // YYYY
39
- [_index2.FYNOV]: /^([0-9]{4})Nov$/,
40
- // YYYY"Nov"
41
- [_index2.FYOCT]: /^([0-9]{4})Oct$/,
42
- // YYYY"Oct"
43
- [_index2.FYJUL]: /^([0-9]{4})July$/,
41
+ [_index2.FYFEB]: /^(\d{4})Feb$/,
42
+ // YYYY"Feb"
43
+ [_index2.FYAPR]: /^(\d{4})April$/,
44
+ // YYYY"April"
45
+ [_index2.FYJUL]: /^(\d{4})July$/,
44
46
  // YYYY"July"
45
- [_index2.FYAPR]: /^([0-9]{4})April$/ // YYYY"April"
47
+ [_index2.FYAUG]: /^(\d{4})Aug$/,
48
+ // YYYY"Aug"
49
+ [_index2.FYSEP]: /^(\d{4})Sep$/,
50
+ // YYYY"Sep"
51
+ [_index2.FYOCT]: /^(\d{4})Oct$/,
52
+ // YYYY"Oct"
53
+ [_index2.FYNOV]: /^(\d{4})Nov$/ // YYYY"Nov"
46
54
  };
47
55
  const getPeriods = ({
48
56
  periodType,
@@ -207,6 +215,12 @@ const getOptions = periodSettings => {
207
215
  startDay: 4
208
216
  }, filterFuturePeriods, periodSettings),
209
217
  name: _index.default.t('Weekly (Start Thursday)')
218
+ }, {
219
+ id: _index2.WEEKLYFRI,
220
+ getPeriods: getWeeklyPeriodType({
221
+ startDay: 5
222
+ }, filterFuturePeriods, periodSettings),
223
+ name: _index.default.t('Weekly (Start Friday)')
210
224
  }, {
211
225
  id: _index2.WEEKLYSAT,
212
226
  getPeriods: getWeeklyPeriodType({
@@ -3,11 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.filterPeriodTypesById = exports.YEARLY = exports.WEEKS_THIS_YEAR = exports.WEEKLYWED = exports.WEEKLYTHU = exports.WEEKLYSUN = exports.WEEKLYSAT = exports.WEEKLY = exports.SIXMONTHLYAPR = exports.SIXMONTHLY = exports.QUARTERLY = exports.MONTHLY = exports.FYSEP = exports.FYOCT = exports.FYNOV = exports.FYJUL = exports.FYFEB = exports.FYAUG = exports.FYAPR = exports.FINANCIAL = exports.DAILY = exports.BIWEEKLY = exports.BIMONTHLY = void 0;
6
+ exports.filterPeriodTypesById = exports.YEARLY = exports.WEEKS_THIS_YEAR = exports.WEEKLYWED = exports.WEEKLYTHU = exports.WEEKLYSUN = exports.WEEKLYSAT = exports.WEEKLYFRI = exports.WEEKLY = exports.SIXMONTHLYAPR = exports.SIXMONTHLY = exports.QUARTERLY = exports.MONTHLY = exports.FYSEP = exports.FYOCT = exports.FYNOV = exports.FYJUL = exports.FYFEB = exports.FYAUG = exports.FYAPR = exports.FINANCIAL = exports.DAILY = exports.BIWEEKLY = exports.BIMONTHLY = void 0;
7
7
  const DAILY = exports.DAILY = 'DAILY';
8
8
  const WEEKLY = exports.WEEKLY = 'WEEKLY';
9
9
  const WEEKLYWED = exports.WEEKLYWED = 'WEEKLYWED';
10
10
  const WEEKLYTHU = exports.WEEKLYTHU = 'WEEKLYTHU';
11
+ const WEEKLYFRI = exports.WEEKLYFRI = 'WEEKLYFRI';
11
12
  const WEEKLYSAT = exports.WEEKLYSAT = 'WEEKLYSAT';
12
13
  const WEEKLYSUN = exports.WEEKLYSUN = 'WEEKLYSUN';
13
14
  const WEEKS_THIS_YEAR = exports.WEEKS_THIS_YEAR = 'WEEKS_THIS_YEAR';
@@ -241,6 +241,7 @@ var _exportNames = {
241
241
  WEEKLY: true,
242
242
  WEEKLYWED: true,
243
243
  WEEKLYTHU: true,
244
+ WEEKLYFRI: true,
244
245
  WEEKLYSAT: true,
245
246
  WEEKLYSUN: true,
246
247
  WEEKS_THIS_YEAR: true,
@@ -252,10 +253,13 @@ var _exportNames = {
252
253
  SIXMONTHLYAPR: true,
253
254
  YEARLY: true,
254
255
  FINANCIAL: true,
255
- FYNOV: true,
256
- FYOCT: true,
257
- FYJUL: true,
256
+ FYFEB: true,
258
257
  FYAPR: true,
258
+ FYJUL: true,
259
+ FYAUG: true,
260
+ FYSEP: true,
261
+ FYOCT: true,
262
+ FYNOV: true,
259
263
  getRelativePeriodsOptionsById: true,
260
264
  getRelativePeriodsName: true,
261
265
  getRelativePeriodsDetails: true,
@@ -707,6 +711,18 @@ Object.defineProperty(exports, "FYAPR", {
707
711
  return _index12.FYAPR;
708
712
  }
709
713
  });
714
+ Object.defineProperty(exports, "FYAUG", {
715
+ enumerable: true,
716
+ get: function () {
717
+ return _index12.FYAUG;
718
+ }
719
+ });
720
+ Object.defineProperty(exports, "FYFEB", {
721
+ enumerable: true,
722
+ get: function () {
723
+ return _index12.FYFEB;
724
+ }
725
+ });
710
726
  Object.defineProperty(exports, "FYJUL", {
711
727
  enumerable: true,
712
728
  get: function () {
@@ -725,6 +741,12 @@ Object.defineProperty(exports, "FYOCT", {
725
741
  return _index12.FYOCT;
726
742
  }
727
743
  });
744
+ Object.defineProperty(exports, "FYSEP", {
745
+ enumerable: true,
746
+ get: function () {
747
+ return _index12.FYSEP;
748
+ }
749
+ });
728
750
  Object.defineProperty(exports, "FileMenu", {
729
751
  enumerable: true,
730
752
  get: function () {
@@ -1313,6 +1335,12 @@ Object.defineProperty(exports, "WEEKLY", {
1313
1335
  return _index12.WEEKLY;
1314
1336
  }
1315
1337
  });
1338
+ Object.defineProperty(exports, "WEEKLYFRI", {
1339
+ enumerable: true,
1340
+ get: function () {
1341
+ return _index12.WEEKLYFRI;
1342
+ }
1343
+ });
1316
1344
  Object.defineProperty(exports, "WEEKLYSAT", {
1317
1345
  enumerable: true,
1318
1346
  get: function () {
@@ -265,6 +265,7 @@
265
265
  "Weekly": "Weekly",
266
266
  "Weekly (Start Wednesday)": "Weekly (Start Wednesday)",
267
267
  "Weekly (Start Thursday)": "Weekly (Start Thursday)",
268
+ "Weekly (Start Friday)": "Weekly (Start Friday)",
268
269
  "Weekly (Start Saturday)": "Weekly (Start Saturday)",
269
270
  "Weekly (Start Sunday)": "Weekly (Start Sunday)",
270
271
  "Bi-weekly": "Bi-weekly",
@@ -3,7 +3,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
3
3
  import { getNowInCalendar } from '@dhis2/multi-calendar-dates';
4
4
  import { IconInfo16, NoticeBox, TabBar, Tab, Transfer } from '@dhis2/ui';
5
5
  import PropTypes from 'prop-types';
6
- import React, { useRef, useState, useMemo } from 'react';
6
+ import React, { useCallback, useRef, useState, useMemo } from 'react';
7
7
  import PeriodIcon from '../../assets/DimensionItemIcons/PeriodIcon.js'; //TODO: Reimplement the icon.js
8
8
  import i18n from '../../locales/index.js';
9
9
  import { TRANSFER_HEIGHT, TRANSFER_OPTIONS_WIDTH, TRANSFER_SELECTED_WIDTH } from '../../modules/dimensionSelectorHelper.js';
@@ -13,7 +13,7 @@ import FixedPeriodFilter from './FixedPeriodFilter.js';
13
13
  import RelativePeriodFilter from './RelativePeriodFilter.js';
14
14
  import { applyDisplayLabelOverrides, applyFixedPeriodTypeDisplayLabels, filterEnabledFixedPeriodTypes, filterEnabledRelativePeriodTypes } from './utils/enabledPeriodTypes.js';
15
15
  import { getFixedPeriodsOptions } from './utils/fixedPeriods.js';
16
- import { MONTHLY, QUARTERLY, filterPeriodTypesById } from './utils/index.js';
16
+ import { FYFEB, FYAUG, FYSEP, MONTHLY, QUARTERLY, WEEKLYFRI, filterPeriodTypesById } from './utils/index.js';
17
17
  import { getRelativePeriodsOptions } from './utils/relativePeriods.js';
18
18
  const RightHeader = ({
19
19
  infoBoxMessage
@@ -74,9 +74,11 @@ const PeriodTransfer = ({
74
74
  } else {
75
75
  const allFixed = getFixedPeriodsOptions(periodsSettings);
76
76
  const allRelative = getRelativePeriodsOptions();
77
+ const v43PeriodTypes = [WEEKLYFRI, FYFEB, FYAUG, FYSEP];
78
+ const allExcludedPeriodTypes = [...excludedPeriodTypes, ...v43PeriodTypes];
77
79
  return {
78
- filteredFixedOptions: filterPeriodTypesById(allFixed, excludedPeriodTypes),
79
- filteredRelativeOptions: filterPeriodTypesById(allRelative, excludedPeriodTypes)
80
+ filteredFixedOptions: filterPeriodTypesById(allFixed, allExcludedPeriodTypes),
81
+ filteredRelativeOptions: filterPeriodTypesById(allRelative, allExcludedPeriodTypes)
80
82
  };
81
83
  }
82
84
  }, [supportsEnabledPeriodTypes, enabledPeriodTypesData, excludedPeriodTypes, periodsSettings]);
@@ -95,11 +97,11 @@ const PeriodTransfer = ({
95
97
  // use ".eraYear" rather than ".year" because in Ethiopian calendar, eraYear is what our users expect to see (for other calendars, it doesn't matter)
96
98
  // there is still a pending decision in Temporal regarding which era to use by default: https://github.com/js-temporal/temporal-polyfill/blob/9350ee7dd0d29f329fc097debf923a517c32f813/lib/calendar.ts#L1964
97
99
  const defaultFixedPeriodYear = now.eraYear || now.year;
98
- const fixedPeriodConfig = year => ({
100
+ const fixedPeriodConfig = useCallback(year => ({
99
101
  offset: year - defaultFixedPeriodYear,
100
102
  filterFuturePeriods: false,
101
103
  reversePeriods: false
102
- });
104
+ }), [defaultFixedPeriodYear]);
103
105
  const [userPeriods, setUserPeriods] = useState(null);
104
106
  const [isRelative, setIsRelative] = useState(true);
105
107
  const [relativeFilter, setRelativeFilter] = useState({
@@ -144,7 +146,7 @@ const PeriodTransfer = ({
144
146
  const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
145
147
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
146
148
  }
147
- }, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year]);
149
+ }, [isRelative, effectiveRelativeFilterType, effectiveFixedFilterType, filteredRelativeOptions, filteredFixedOptions, fixedFilter.year, fixedPeriodConfig]);
148
150
  const allPeriods = userPeriods !== null && userPeriods !== void 0 ? userPeriods : derivedPeriods;
149
151
  const isActive = value => {
150
152
  const item = selectedItems.find(item => item.id === value);
@@ -205,7 +207,7 @@ const PeriodTransfer = ({
205
207
  }, styles));
206
208
  const onSelectFixedPeriods = filter => {
207
209
  setFixedFilter(filter);
208
- if (filter.year.match(/[0-9]{4}/)) {
210
+ if (filter.year.match(/\d{4}/)) {
209
211
  const selectedOption = filteredFixedOptions.find(opt => opt.id === filter.periodType);
210
212
  setUserPeriods((selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.getPeriods(fixedPeriodConfig(Number(filter.year)))) || []);
211
213
  }
@@ -6,7 +6,7 @@ describe('fixedPeriods utils', () => {
6
6
  describe('getOptions', () => {
7
7
  it('should return a list of available period ranges', () => {
8
8
  const periodIds = getFixedPeriodsOptions().map(option => option.id);
9
- expect(periodIds).toEqual(['DAILY', 'WEEKLY', 'WEEKLYWED', 'WEEKLYTHU', 'WEEKLYSAT', 'WEEKLYSUN', 'BIWEEKLY', 'MONTHLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYOCT', 'FYNOV']);
9
+ expect(periodIds).toEqual(['DAILY', 'WEEKLY', 'WEEKLYWED', 'WEEKLYTHU', 'WEEKLYFRI', 'WEEKLYSAT', 'WEEKLYSUN', 'BIWEEKLY', 'MONTHLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYOCT', 'FYNOV']);
10
10
  });
11
11
  });
12
12
  describe('Daily period generator', () => {
@@ -6,7 +6,7 @@ describe('utils', () => {
6
6
  it('should filter fixed periods', () => {
7
7
  const excludedPeriodTypes = ['DAILY', 'WEEKLY', 'WEEKLYSAT', 'MONTHLY', 'FYOCT'];
8
8
  const periodIds = filterPeriodTypesById(getFixedPeriodsOptions(), excludedPeriodTypes).map(option => option.id);
9
- expect(periodIds).toEqual(['WEEKLYWED', 'WEEKLYTHU', 'WEEKLYSUN', 'BIWEEKLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYNOV']);
9
+ expect(periodIds).toEqual(['WEEKLYWED', 'WEEKLYTHU', 'WEEKLYFRI', 'WEEKLYSUN', 'BIWEEKLY', 'BIMONTHLY', 'QUARTERLY', 'SIXMONTHLY', 'SIXMONTHLYAPR', 'YEARLY', 'FYFEB', 'FYAPR', 'FYJUL', 'FYAUG', 'FYSEP', 'FYNOV']);
10
10
  });
11
11
  it('should filter relative periods', () => {
12
12
  const excludedPeriodTypes = ['MONTHLY', 'BIMONTHLY'];
@@ -19,8 +19,10 @@ const v43Query = {
19
19
 
20
20
  // v43-only: analyticsFinancialYearStart is removed in v44
21
21
  const FY_SETTING_TO_SERVER_PT = {
22
+ FINANCIAL_YEAR_FEBRUARY: 'FinancialFeb',
22
23
  FINANCIAL_YEAR_APRIL: 'FinancialApril',
23
24
  FINANCIAL_YEAR_JULY: 'FinancialJuly',
25
+ FINANCIAL_YEAR_AUGUST: 'FinancialAug',
24
26
  FINANCIAL_YEAR_SEPTEMBER: 'FinancialSep',
25
27
  FINANCIAL_YEAR_OCTOBER: 'FinancialOct',
26
28
  FINANCIAL_YEAR_NOVEMBER: 'FinancialNov'
@@ -1,41 +1,49 @@
1
1
  import { generateFixedPeriods, getNowInCalendar } from '@dhis2/multi-calendar-dates';
2
2
  import i18n from '../../../locales/index.js';
3
- import { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FYFEB, FYAPR, FYJUL, FYAUG, FYSEP, FYOCT, FYNOV } from './index.js';
3
+ import { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYFRI, WEEKLYSAT, WEEKLYSUN, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FYFEB, FYAPR, FYJUL, FYAUG, FYSEP, FYOCT, FYNOV } from './index.js';
4
4
  export const PERIOD_TYPE_REGEX = {
5
- [DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
5
+ [DAILY]: /^(\d{4})(\d{2})(\d{2})$/,
6
6
  // YYYYMMDD
7
- [WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/,
7
+ [WEEKLY]: /^(\d{4})W(\d{1,2})$/,
8
8
  // YYYY"W"[1-53]
9
- [BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/,
9
+ [BIWEEKLY]: /^(\d{4})BiW(\d{1,2})$/,
10
10
  // YYYY"BiW"[1-27]
11
- [WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/,
11
+ [WEEKLYWED]: /^(\d{4})(Wed)W(\d{1,2})$/,
12
12
  // YYYY"WedW"[1-53]
13
- [WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/,
13
+ [WEEKLYTHU]: /^(\d{4})(Thu)W(\d{1,2})$/,
14
14
  // YYYY"ThuW"[1-53]
15
- [WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/,
15
+ [WEEKLYFRI]: /^(\d{4})(Fri)W(\d{1,2})$/,
16
+ // YYYY"FriW"[1-53]
17
+ [WEEKLYSAT]: /^(\d{4})(Sat)W(\d{1,2})$/,
16
18
  // YYYY"SatW"[1-53]
17
- [WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/,
19
+ [WEEKLYSUN]: /^(\d{4})(Sun)W(\d{1,2})$/,
18
20
  // YYYY"SunW"[1-53]
19
- [MONTHLY]: /^([0-9]{4})([0-9]{2})$/,
21
+ [MONTHLY]: /^(\d{4})(\d{2})$/,
20
22
  // YYYYMM
21
- [BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/,
23
+ [BIMONTHLY]: /^(\d{4})(\d{2})B$/,
22
24
  // YYYY0[1-6]"B"
23
- [QUARTERLY]: /^([0-9]{4})Q([1234])$/,
25
+ [QUARTERLY]: /^(\d{4})Q([1234])$/,
24
26
  // YYYY"Q"[1-4]
25
- [SIXMONTHLY]: /^([0-9]{4})S([12])$/,
27
+ [SIXMONTHLY]: /^(\d{4})S([12])$/,
26
28
  // YYYY"S"[1/2]
27
- [SIXMONTHLYAPR]: /^([0-9]{4})AprilS([12])$/,
29
+ [SIXMONTHLYAPR]: /^(\d{4})AprilS([12])$/,
28
30
  // YYYY"AprilS"[1/2]
29
- // [SIXMONTHLYNOV]: /^([0-9]{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
30
- [YEARLY]: /^([0-9]{4})$/,
31
+ // [SIXMONTHLYNOV]: /^(\d{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
32
+ [YEARLY]: /^(\d{4})$/,
31
33
  // YYYY
32
- [FYNOV]: /^([0-9]{4})Nov$/,
33
- // YYYY"Nov"
34
- [FYOCT]: /^([0-9]{4})Oct$/,
35
- // YYYY"Oct"
36
- [FYJUL]: /^([0-9]{4})July$/,
34
+ [FYFEB]: /^(\d{4})Feb$/,
35
+ // YYYY"Feb"
36
+ [FYAPR]: /^(\d{4})April$/,
37
+ // YYYY"April"
38
+ [FYJUL]: /^(\d{4})July$/,
37
39
  // YYYY"July"
38
- [FYAPR]: /^([0-9]{4})April$/ // YYYY"April"
40
+ [FYAUG]: /^(\d{4})Aug$/,
41
+ // YYYY"Aug"
42
+ [FYSEP]: /^(\d{4})Sep$/,
43
+ // YYYY"Sep"
44
+ [FYOCT]: /^(\d{4})Oct$/,
45
+ // YYYY"Oct"
46
+ [FYNOV]: /^(\d{4})Nov$/ // YYYY"Nov"
39
47
  };
40
48
  const getPeriods = ({
41
49
  periodType,
@@ -200,6 +208,12 @@ const getOptions = periodSettings => {
200
208
  startDay: 4
201
209
  }, filterFuturePeriods, periodSettings),
202
210
  name: i18n.t('Weekly (Start Thursday)')
211
+ }, {
212
+ id: WEEKLYFRI,
213
+ getPeriods: getWeeklyPeriodType({
214
+ startDay: 5
215
+ }, filterFuturePeriods, periodSettings),
216
+ name: i18n.t('Weekly (Start Friday)')
203
217
  }, {
204
218
  id: WEEKLYSAT,
205
219
  getPeriods: getWeeklyPeriodType({
@@ -2,6 +2,7 @@ export const DAILY = 'DAILY';
2
2
  export const WEEKLY = 'WEEKLY';
3
3
  export const WEEKLYWED = 'WEEKLYWED';
4
4
  export const WEEKLYTHU = 'WEEKLYTHU';
5
+ export const WEEKLYFRI = 'WEEKLYFRI';
5
6
  export const WEEKLYSAT = 'WEEKLYSAT';
6
7
  export const WEEKLYSUN = 'WEEKLYSUN';
7
8
  export const WEEKS_THIS_YEAR = 'WEEKS_THIS_YEAR';
package/build/es/index.js CHANGED
@@ -145,7 +145,7 @@ export { transformResponse as transformEventAggregateResponse } from './modules/
145
145
  export { COLOR_SET_DEFAULT, COLOR_SET_BASIC, COLOR_SET_EXTENDED, COLOR_SET_BRIGHT, COLOR_SET_DARK, COLOR_SET_GRAY, COLOR_SET_COLOR_BLIND, COLOR_SET_PATTERNS, colorSets } from './visualizations/util/colors/colorSets.js';
146
146
 
147
147
  // Utils: periods
148
- export { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN, WEEKS_THIS_YEAR, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FINANCIAL, FYNOV, FYOCT, FYJUL, FYAPR } from './components/PeriodDimension/utils/index.js';
148
+ export { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYFRI, WEEKLYSAT, WEEKLYSUN, WEEKS_THIS_YEAR, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FINANCIAL, FYFEB, FYAPR, FYJUL, FYAUG, FYSEP, FYOCT, FYNOV } from './components/PeriodDimension/utils/index.js';
149
149
  export { getRelativePeriodsOptionsById, getRelativePeriodsName, getRelativePeriodsDetails } from './components/PeriodDimension/utils/relativePeriods.js';
150
150
  export { getFixedPeriodsOptionsById, PERIOD_TYPE_REGEX } from './components/PeriodDimension/utils/fixedPeriods.js';
151
151
  export { default as VisualizationOptions } from './components/Options/VisualizationOptions.js';
@@ -265,6 +265,7 @@
265
265
  "Weekly": "Weekly",
266
266
  "Weekly (Start Wednesday)": "Weekly (Start Wednesday)",
267
267
  "Weekly (Start Thursday)": "Weekly (Start Thursday)",
268
+ "Weekly (Start Friday)": "Weekly (Start Friday)",
268
269
  "Weekly (Start Saturday)": "Weekly (Start Saturday)",
269
270
  "Weekly (Start Sunday)": "Weekly (Start Sunday)",
270
271
  "Bi-weekly": "Bi-weekly",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "29.3.0",
3
+ "version": "29.3.2",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {