Skip to content

Commit

Permalink
feat: specify calendar type from system settings
Browse files Browse the repository at this point in the history
  • Loading branch information
d-rita committed Jun 7, 2024
1 parent 6f19cb6 commit 025fd7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/data-workspace/inputs/date-input.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useConfig } from '@dhis2/app-runtime'
import { CalendarInput } from '@dhis2/ui'
import cx from 'classnames'
import React from 'react'
Expand All @@ -22,6 +23,10 @@ export const DateInput = ({
},
} = useUserInfo()

const {
systemInfo: { calendar },
} = useConfig()

const { input, meta } = useField(fieldname, {
subscription: {
value: true,
Expand Down Expand Up @@ -71,7 +76,7 @@ export const DateInput = ({
disabled={disabled}
readOnly={locked}
date={input.value}
calendar={'gregory'}
calendar={calendar}
onDateSelect={(date) => {
input.onChange(date?.calendarDateString)
}}
Expand Down
1 change: 0 additions & 1 deletion src/data-workspace/inputs/generic-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from './validators.js'

const htmlTypeAttrsByValueType = {
[VALUE_TYPES.DATE]: 'date',
[VALUE_TYPES.DATETIME]: 'datetime-local',
[VALUE_TYPES.EMAIL]: 'email',
[VALUE_TYPES.PHONE_NUMBER]: 'tel',
Expand Down

0 comments on commit 025fd7f

Please sign in to comment.