Skip to content

Commit 29436e1

Browse files
authored
fix: validate date string before converting to LocalDate (#6880) (#6883)
* fix: validate date string before converting * docs: update CHANGELOG
1 parent 226d6f5 commit 29436e1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## [1.3.5](https://github.com/opencrvs/opencrvs-core/compare/v1.3.4...v1.3.5)
22

3+
## Bug fixes
4+
- #### Fix download failure for incomplete (without date of death) death declarations [#6807](https://github.com/opencrvs/opencrvs-core/issues/6807)
5+
36
## [1.3.4](https://github.com/opencrvs/opencrvs-core/compare/v1.3.3...v1.3.4)
47

58
## Bug fixes

packages/client/src/forms/register/mappings/event-specific-fields/death/query/deceased-mappings.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010
*/
1111
import { IFormField, IFormData } from '@client/forms'
12-
import { formatPlainDate } from '@client/utils/date-formatting'
12+
import {
13+
formatPlainDate,
14+
isValidPlainDate
15+
} from '@client/utils/date-formatting'
1316

1417
export const deceasedDateToFieldTransformation =
1518
(alternativeSectionId?: string) =>
@@ -46,8 +49,7 @@ export const deceasedDateFormatTransformation =
4649
}
4750
const queryValue = queryData[fromSectionId].deceased.deathDate
4851

49-
const date = new Date(queryValue)
50-
if (!Number.isNaN(date.getTime())) {
52+
if (isValidPlainDate(queryValue)) {
5153
const prevLocale = window.__localeId__
5254
window.__localeId__ = locale
5355

0 commit comments

Comments
 (0)