Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into hv/feat/DHIS2-18017…
Browse files Browse the repository at this point in the history
…_AbilityToUnlinkEvent
  • Loading branch information
henrikmv committed Dec 14, 2024
2 parents 93579fa + be9cef9 commit c502b84
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [101.19.3](https://github.com/dhis2/capture-app/compare/v101.19.2...v101.19.3) (2024-12-13)


### Bug Fixes

* [DHIS2-18614] prevent runtime error when only one date range is selected ([#3906](https://github.com/dhis2/capture-app/issues/3906)) ([4699a84](https://github.com/dhis2/capture-app/commit/4699a84b138a17bc42fae5be6685a71b840c1a43))

## [101.19.2](https://github.com/dhis2/capture-app/compare/v101.19.1...v101.19.2) (2024-12-08)


Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capture-app",
"homepage": ".",
"version": "101.19.2",
"version": "101.19.3",
"cacheVersion": "7",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "101.19.2",
"@dhis2/rules-engine-javascript": "101.19.3",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rules-engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/rules-engine-javascript",
"version": "101.19.2",
"version": "101.19.3",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,24 @@ const getRelativeRangeErrors = (startValue, endValue, submitAttempted) => {
return errors;
};

const isAbsoluteRangeFilterValid = (fromValue, toValue) => {
if (!fromValue && !toValue) {
const isAbsoluteRangeFilterValid = (from, to) => {
if (!from?.value && !to?.value) {
return false;
}
const fromValue = from?.value;
const toValue = to?.value;
const parseResultFrom = fromValue ? parseDate(fromValue) : { isValid: true, moment: null };
const parseResultTo = toValue ? parseDate(toValue) : { isValid: true, moment: null };

if ((fromValue && !fromValue.isValid) || (toValue && !toValue.isValid)) {
if (!(parseResultFrom.isValid && parseResultTo.isValid)) {
return false;
}
const isValidMomentDate = () =>
parseResultFrom.momentDate &&
parseResultTo.momentDate &&
parseResultFrom.momentDate.isAfter(parseResultTo.momentDate);

return !DateFilter.isFromAfterTo(fromValue?.value, toValue?.value);
return !isValidMomentDate();
};

const isRelativeRangeFilterValid = (startValue, endValue) => {
Expand Down

0 comments on commit c502b84

Please sign in to comment.