Skip to content
New issue

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

[TimePicker] In different time zones, the default value selected by the panel will be different #2726

Open
1 task done
YannLynn opened this issue Feb 24, 2025 · 0 comments · May be fixed by #2727
Open
1 task done
Assignees

Comments

@YannLynn
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

TimePicker

Semi Version

latest

Current Behavior

Image
仅在东八区时区下,时间从0开始,别的时区下(如图)不是从0开始的时间

Expected Behavior

用户不填 value / defaultValue 的情况下,不论哪个时区,默认选中的时间都从0开始

Steps To Reproduce

No response

ReproducibleCode

import React, { useState, useMemo } from 'react';
import * as dateFns from 'date-fns';
import { TimePicker, Button } from '@douyinfe/semi-ui';
import { IconChevronDown, IconClose } from '@douyinfe/semi-icons';

function Demo() {
    const formatToken = 'HH:mm:ss';
    const [time, setTime] = useState();

    return (
        <TimePicker
            value={time}
            format={formatToken}
            onChange={time => setTime(time)}
            triggerRender={({ placeholder }) => (
                <Tag
                    color='cyan'
                    size='large'
                    shape='circle'
                    style={{ padding: 12, paddingRight: 16, fontSize: 14 }}
                    theme={'light'}
                    prefixIcon={<IconTimePicker />}
                >
                    {time ? dateFns.format(time, formatToken) : placeholder}
                </Tag>
            )}
        />
    );
}
Here is the code that you can reproduce the problem. like I mentioned before due to the time zone setting, it starts from 8 on my computer

Environment

- OS:
- browser:

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant