Skip to content

Commit

Permalink
Re-add support for YYYY date/datetimes in populate
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Jul 31, 2023
1 parent 54948bb commit 32e0977
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dayjs": "^1.11.7",
"fhirclient": "^2.5.2",
"fhirpath": "^3.6.0",
"html-react-parser": "^3.0.16",
"html-react-parser": "^4.2.0",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.filter": "^4.6.0",
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/sdc-populate/src/constructResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function getAnswerValues(
* @author Sean Fong
*/
export function checkIsDate(value: string): boolean {
const acceptedFormats = ['YYYY-MM', 'YYYY-MM-DD'];
const acceptedFormats = ['YYYY', 'YYYY-MM', 'YYYY-MM-DD'];
return dayjs(value, acceptedFormats, true).isValid();
}

Expand All @@ -282,7 +282,7 @@ export function checkIsDate(value: string): boolean {
* @author Sean Fong
*/
export function checkIsDateTime(value: string): boolean {
const acceptedFormats = ['YYYY-MM', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ'];
const acceptedFormats = ['YYYY', 'YYYY-MM', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ'];
return moment(value, acceptedFormats, true).isValid();
}

Expand Down

0 comments on commit 32e0977

Please sign in to comment.