From 2033e7dd92e60fbb5f4dd120df828e99cee8f0fa Mon Sep 17 00:00:00 2001 From: drita Date: Fri, 7 Jun 2024 14:44:04 +0300 Subject: [PATCH] feat: specify calendar type from system settings --- src/data-workspace/inputs/date-input.js | 10 +++++++--- src/data-workspace/inputs/generic-input.js | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/data-workspace/inputs/date-input.js b/src/data-workspace/inputs/date-input.js index 8b8345dfe3..4c0207d4cd 100644 --- a/src/data-workspace/inputs/date-input.js +++ b/src/data-workspace/inputs/date-input.js @@ -1,5 +1,5 @@ +import { useConfig } from '@dhis2/app-runtime' import { CalendarInput } from '@dhis2/ui' -import cx from 'classnames' import React from 'react' import { useField } from 'react-final-form' import { useSetDataValueMutation, useUserInfo } from '../../shared/index.js' @@ -22,6 +22,10 @@ export const DateInput = ({ }, } = useUserInfo() + const { + systemInfo: { calendar }, + } = useConfig() + const { input, meta } = useField(fieldname, { subscription: { value: true, @@ -57,7 +61,7 @@ export const DateInput = ({ return ( { input.onFocus(...args) onFocus?.(...args) @@ -71,7 +75,7 @@ export const DateInput = ({ disabled={disabled} readOnly={locked} date={input.value} - calendar={'gregory'} + calendar={calendar} onDateSelect={(date) => { input.onChange(date?.calendarDateString) }} diff --git a/src/data-workspace/inputs/generic-input.js b/src/data-workspace/inputs/generic-input.js index 615e46cf1a..bd4f1b4a65 100644 --- a/src/data-workspace/inputs/generic-input.js +++ b/src/data-workspace/inputs/generic-input.js @@ -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',