fix(web): time tool add time zone
This commit is contained in:
@@ -5,6 +5,8 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import type { ToolItem, TimeToolModalRef } from '../types'
|
import type { ToolItem, TimeToolModalRef } from '../types'
|
||||||
import RbModal from '@/components/RbModal';
|
import RbModal from '@/components/RbModal';
|
||||||
import { execute } from '@/api/tools';
|
import { execute } from '@/api/tools';
|
||||||
|
import { useI18n } from '@/store/locale'
|
||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
const tabKeys = ['currentTime', 'timestampConversion', 'timeFormat']
|
const tabKeys = ['currentTime', 'timestampConversion', 'timeFormat']
|
||||||
@@ -24,6 +26,7 @@ interface CurrentTimeObj {
|
|||||||
}
|
}
|
||||||
const TimeToolModal = forwardRef<TimeToolModalRef>((_props, ref) => {
|
const TimeToolModal = forwardRef<TimeToolModalRef>((_props, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { timeZone } = useI18n()
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [form] = Form.useForm<{ timestamp: string; formatType: string; }>();
|
const [form] = Form.useForm<{ timestamp: string; formatType: string; }>();
|
||||||
const [data, setData] = useState<ToolItem>({} as ToolItem)
|
const [data, setData] = useState<ToolItem>({} as ToolItem)
|
||||||
@@ -81,6 +84,7 @@ const TimeToolModal = forwardRef<TimeToolModalRef>((_props, ref) => {
|
|||||||
"parameters": {
|
"parameters": {
|
||||||
"operation": "timestamp_to_datetime",
|
"operation": "timestamp_to_datetime",
|
||||||
"input_value": timestamp,
|
"input_value": timestamp,
|
||||||
|
"to_timezone": timeZone
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -95,7 +99,7 @@ const TimeToolModal = forwardRef<TimeToolModalRef>((_props, ref) => {
|
|||||||
parameters: {
|
parameters: {
|
||||||
operation: 'now',
|
operation: 'now',
|
||||||
output_format: values.formatType,
|
output_format: values.formatType,
|
||||||
to_timezone: 'UTC'
|
to_timezone: timeZone
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
const response = res as { data: CurrentTimeObj }
|
const response = res as { data: CurrentTimeObj }
|
||||||
|
|||||||
Reference in New Issue
Block a user