diff --git a/src/common/DatePicker.tsx b/src/common/DatePicker.tsx
index b624120d0..622990956 100644
--- a/src/common/DatePicker.tsx
+++ b/src/common/DatePicker.tsx
@@ -2,7 +2,9 @@ import { memo } from "react";
import Field from "@/common/Field";
import { WidgetProps } from "@/types";
import { DateTime } from "@gisce/ooui";
-import { DateInput } from "@gisce/react-formiga-components";
+import { DateMaskedInput, DateInput } from "@gisce/react-formiga-components";
+import { useUserFeatureIsEnabled } from "@/context/ConfigContext";
+import { UserFeatureKeys } from "@/models/userFeature";
type DatePickerProps = WidgetProps & {
showTime?: boolean;
@@ -11,6 +13,23 @@ type DatePickerProps = WidgetProps & {
const DatePicker = (props: DatePickerProps) => {
const { ooui, showTime = false } = props;
const { required, readOnly = false, timezone } = ooui as DateTime;
+ const useMaskedInput = useUserFeatureIsEnabled(
+ UserFeatureKeys.FEATURE_DATE_USE_MASKED_INPUT,
+ );
+
+ if (useMaskedInput) {
+ return (
+
+
+
+ );
+ }
return (
diff --git a/src/models/userFeature.ts b/src/models/userFeature.ts
index 2912366a8..90275a562 100644
--- a/src/models/userFeature.ts
+++ b/src/models/userFeature.ts
@@ -3,6 +3,7 @@ export enum UserFeatureKeys {
FEATURE_MANY2ONE_DISABLE_FOLDER = "widget.many2one.disable.folder",
FEATURE_MANY2ONE_SELECTION_TO_LAZY = "widget.many2one.selection_to_many2onelazy",
FEATURE_ONE2MANY_ENABLE_NEW_TABLE = "widget.one2many.enable_new_table",
+ FEATURE_DATE_USE_MASKED_INPUT = "widget.date.use_masked_input",
FEATURE_TEST_FEATURE = "test.feature",
}
diff --git a/src/widgets/base/Time.tsx b/src/widgets/base/Time.tsx
index e19f9f4f8..1eec08f41 100644
--- a/src/widgets/base/Time.tsx
+++ b/src/widgets/base/Time.tsx
@@ -1,9 +1,12 @@
import Field from "@/common/Field";
import { Time as TimeOoui } from "@gisce/ooui";
import { WidgetProps } from "@/types";
+import { DateMaskedInput } from "@gisce/react-formiga-components";
+import { useUserFeatureIsEnabled } from "@/context/ConfigContext";
+import { UserFeatureKeys } from "@/models/userFeature";
import dayjs from "@/helpers/dayjs";
import { Dayjs } from "dayjs";
-import { TimePicker } from "../../common/TimePicker";
+import { TimePicker } from "@/common/TimePicker";
const Time = (props: WidgetProps) => {
const { ooui } = props;
@@ -18,13 +21,34 @@ const Time = (props: WidgetProps) => {
type TimeInputProps = {
ooui: TimeOoui;
value?: string;
- onChange?: (value?: string) => void;
+ onChange?: (value?: string | null) => void;
};
export const TimeInput = (props: TimeInputProps) => {
- const { readOnly } = props.ooui;
+ const { readOnly, required } = props.ooui;
+ const useMaskedInput = useUserFeatureIsEnabled(
+ UserFeatureKeys.FEATURE_DATE_USE_MASKED_INPUT,
+ );
+
+ const handleChange = (value: string | null | undefined) => {
+ if (props.onChange) {
+ props.onChange(value ?? undefined);
+ }
+ };
+
+ if (useMaskedInput) {
+ return (
+
+ );
+ }
- const onChange = (_time: Dayjs | null, timestring?: string) => {
+ const handleTimePickerChange = (_time: Dayjs | null, timestring?: string) => {
if (props.onChange) {
props.onChange(timestring);
}
@@ -32,8 +56,8 @@ export const TimeInput = (props: TimeInputProps) => {
return (