-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Reason for delayed registration in v2 birth (#8533)
* feat: add `isBefore` * fix: rename `isBefore` to `isAfter` * feat: add not.beforeNow() * fix: unexpected validation errors when days or months are single digit * chore: upgrade toolkit * fix: apply suggested changes * fix: refine date range * test: add unit test for `formatDateFieldValue` function
- Loading branch information
Showing
5 changed files
with
202 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/client/src/v2-events/components/forms/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* OpenCRVS is also distributed under the terms of the Civil Registration | ||
* & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
* | ||
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
*/ | ||
|
||
import { formatDateFieldValue } from './utils' | ||
|
||
describe('Verify formatDateFieldValue', () => { | ||
it('Formats date properly', () => { | ||
const cases = [ | ||
{ | ||
input: '--', | ||
expectedOutput: '00-00-00' | ||
}, | ||
{ | ||
input: '01-02-', | ||
expectedOutput: '01-02-00' | ||
}, | ||
{ | ||
input: '1-2-3', | ||
expectedOutput: '01-02-03' | ||
}, | ||
{ | ||
input: '01-2-32', | ||
expectedOutput: '01-02-32' | ||
}, | ||
{ | ||
input: '2025-2-3', | ||
expectedOutput: '2025-02-03' | ||
} | ||
] | ||
|
||
cases.forEach(({ input, expectedOutput }) => | ||
expect(formatDateFieldValue(input)).toBe(expectedOutput) | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters