diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx
index f8a525225..e91f84e8b 100644
--- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx
+++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx
@@ -2,36 +2,30 @@ import React, { useState } from 'react';
import { connect, mapProps, mapReadPretty } from '@tachybase/schema';
import { dayjs } from '@tachybase/utils/client';
-import { Button, DatePicker, Input, Space } from 'antd-mobile';
+import { Button, DatePicker } from 'antd-mobile';
+
+import { useTranslation } from '../../../../../locale';
export const MDatePicker = connect(
(props) => {
+ const { t } = useTranslation();
+ const { value, onChange } = props;
const [visible, setVisible] = useState(false);
- const nowDate = props?.value || new Date();
- if (!props?.value) {
- props.onChange(nowDate);
- }
+ const [dateValue, setDateValue] = useState(value);
+
+ const dateValueShow = dateValue ? dayjs(dateValue).format('YYYY-MM-DD') : t('please enter the date');
+
+ const openPicker = () => setVisible(true);
+ const closePicker = () => setVisible(false);
+ const selectDateValue = (value) => {
+ setDateValue(value);
+ onChange(value);
+ setVisible(false);
+ };
return (
<>
-
-
- {
- setVisible(false);
- }}
- value={nowDate}
- onConfirm={(value) => {
- props.onChange(value);
- setVisible(false);
- }}
- />
+
+
>
);
},
diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/locale/en-US.json b/packages/plugins/@tachybase/plugin-mobile-client/src/locale/en-US.json
index 17ee585d3..4f8cc7014 100644
--- a/packages/plugins/@tachybase/plugin-mobile-client/src/locale/en-US.json
+++ b/packages/plugins/@tachybase/plugin-mobile-client/src/locale/en-US.json
@@ -46,5 +46,6 @@
"all": "all",
"AllProducts": "AllProducts",
"sort":"sort",
- "Add new":"Add new"
+ "Add new":"Add new",
+ "please enter the date": "please enter the date"
}
diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/locale/zh-CN.json b/packages/plugins/@tachybase/plugin-mobile-client/src/locale/zh-CN.json
index ea2b9f76b..598bacf7c 100644
--- a/packages/plugins/@tachybase/plugin-mobile-client/src/locale/zh-CN.json
+++ b/packages/plugins/@tachybase/plugin-mobile-client/src/locale/zh-CN.json
@@ -49,5 +49,6 @@
"Swiper":"轮播图",
"TabSearch":"表格搜索",
"ImageSearch":"图片搜索",
- "Add new":"添加"
+ "Add new":"添加",
+ "please enter the date": "请输入日期"
}