We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DatePicker
2.31.2
No response
import React, { useMemo, useState } from 'react'; import { ConfigProvider, Select, DatePicker, TimePicker } from '@douyinfe/semi-ui'; function App(props = {}) { const [timeZone, setTimeZone] = useState('GMT+09:00'); const gmtList = useMemo(() => { const list = []; for (let hourOffset = -11; hourOffset <= 14; hourOffset++) { const prefix = hourOffset >= 0 ? '+' : '-'; const hOffset = Math.abs(parseInt(hourOffset, 10)); list.push(`GMT${prefix}${String(hOffset).padStart(2, '0')}:00`); } return list; }, []); const [dValue, setDValue] = useState(new Date().valueOf()); return ( // <ConfigProvider timeZone={timeZone}> <div style={{ width: 300 }}> <h5 style={{ margin: 10 }}>Select Time Zone:</h5> <Select placeholder={'请选择时区'} style={{ width: 300 }} value={timeZone} showClear={true} onSelect={value => setTimeZone(value)} > {gmtList.map(gmt => ( <Select.Option key={gmt} value={gmt}> {gmt} </Select.Option> ))} </Select> <br /> <br /> <DatePicker type={'dateTime'} value={dValue} timeZone={timeZone} onChange={(date, dateString) => { console.log('DatePicker changed: ', date.valueOf(), date) let newD = Number.parseInt(String(Number(date)), 10); console.log(newD); setDValue(newD) }} /> </div> // </ConfigProvider> ); } export default App;
### Environment ```markdown - OS: - browser:
Relative Modify:marnusw/date-fns-tz@3bd32ee#diff-4c06f3ee39f66c80220e59b7d2c1f7d21d5406d5870dd737bd692538467deb69
The text was updated successfully, but these errors were encountered:
fix: fixed DatePicker timeZone bug #1522
a1f09c9
2ee3932
fix: fixed DatePicker timeZone bug #1522 (#1523)
0334d30
Co-authored-by: shijia.me <shijia.me@bytedance.com>
此问题与 date-fns-tz 最近的一次变更有关。有相同问题的同学先在项目里锁死 date-fns-tz 的版本为 1.3.7。
{ "pnpm": { "overrides": { "date-fns-tz": "1.3.7" } } }
{ "resolutions": { "date-fns-tz": "1.3.7" } }
Semi 也对相关逻辑进行了兜底,@douyinfe/semi-ui@latest、@douyinfe/semi-ui@2.31.4 fixed 了此问题,安装 latest 版本的用户不需要再锁定 date-fns-tz 的版本。
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Is there an existing issue for this?
Which Component
DatePicker
Semi Version
2.31.2
Current Behavior
Expected Behavior
No response
Steps To Reproduce
No response
ReproducibleCode
Anything else?
Relative Modify:marnusw/date-fns-tz@3bd32ee#diff-4c06f3ee39f66c80220e59b7d2c1f7d21d5406d5870dd737bd692538467deb69
The text was updated successfully, but these errors were encountered: