Tencent / Tencent/tdesign-flutter

[TDDatePicker] tdesign_flutter: ^0.2.7 初始化时小时未受 dateEnd 限制

Open
#904 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
1.2k
Forks
182
Avg merge
2d 2h
Merged PRs (30d)
88

Description

tdesign-flutter 版本

tdesign_flutter: ^0.2.7 存在

重现链接

暂无在线 Demo,可通过本地初始化 DatePickerModel 复现,复现代码见下方「重现步骤/代码」

重现步骤/代码
复现步骤

1.引入 tdesign_flutter: ^0.2.7,初始化 TDDatePicker,传入以下参数:

DatePickerModel(
  useYear: true,
  useMonth: true,
  useDay: true,
  useHour: true,
  useMinute: true,
  useSecond: true,
  useWeekDay: false,
  dateStart: [2023, 11, 11, 12, 12, 12],
  dateEnd: [2026, 4, 5, 18, 9, 20],
  initialDate: [2026, 4, 5, 17, 47, 58],
)

2.打开时间选择器,查看小时滚轮:
页面刚打开时,小时选项显示 0时 ~ 23时,未被限制到 dateEnd[3] = 18
滑动任意日期后,小时才会被正确限制到 0时 ~ 18时

期望结果
  • 页面刚打开时,小时应被限制到 dateEnd[3](本例为 0时~18时
  • 初始化逻辑与滑动后逻辑保持一致,避免用户误选超过 dateEnd 的时间
实际结果
  • 页面刚打开时,小时选项默认显示 0时~23时,未受 dateEnd 限制
  • 滑动日期后,小时才会被限制到 0时~18时,表现不一致
Flutter版本

flutter 3.11.3

设备与机型信息

No response

系统版本

No response

补充说明
  • 用户选择身体实际康复时间,不能选择未来的时间;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing TDDatePicker and DatePickerModel initialization, then compare it with the date-change handling that updates the hour range. Reproduce the supplied dateStart, dateEnd, and initialDate case, and verify that the initial hour options are limited to 0–18 just as they are after changing the date.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.