Skip to content

Commit

Permalink
fix(time-picker): Unable to modify the number of milliseconds in the …
Browse files Browse the repository at this point in the history
…edit box after formatting the Time Picker (format="HH: mm: ss. SSS") (#5236)

fix(n-time-picker): Unable to modify the number of milliseconds in the edit box after formatting the Time Picker (format="HH: mm: ss. SSS")
  • Loading branch information
qiaoxin111 authored Dec 19, 2023
1 parent 9f62a3a commit 8c326c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
- Fix `n-menu` `show` `default` attribute spelling problem, closes [#4750](https://github.com/tusen-ai/naive-ui/issues/4750).
- Fix `n-icon-wrapper`'s theme error, closes [#4768](https://github.com/tusen-ai/naive-ui/issues/4768).

- Fix `n-popconfirm`'s action button should not be triggered multiple times,closes [#4687](https://github.com/tusen-ai/naive-ui/issues/4687).
- Fix `n-time picker` time picker formatting (format="HH: mm: ss. SSS") preventing modification of milliseconds in the edit box, closes [# 5224]https://github.com/tusen-ai/naive-ui/issues/5224 ).

### Feats

- `n-dynamic-input` adds `action` slot, closes [#3981](https://github.com/tusen-ai/naive-ui/issues/3981).
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
- 修复 `n-upload` 内部使用 vue `TransitionGroup` 组件时,传递了未声明的 prop 且未被自动继承导致警告,关闭[#4447](https://github.com/tusen-ai/naive-ui/issues/4447)
- 修复 `n-menu` `show` `default` 属性拼写问题,关闭 [#4750](https://github.com/tusen-ai/naive-ui/issues/4750)
- 修复 `n-icon-wrapper` 的主题异常,关闭 [#4768](https://github.com/tusen-ai/naive-ui/issues/4768)
- 修复 `n-popconfirm` 操作按钮不应该被多次触发,关闭 [#4687][https://github.com/tusen-ai/naive-ui/issues/4687]
- 修复 `n-time-picker` 时间选择器 Time Picker 格式化(format="HH:mm:ss.SSS")后无法在编辑框内修改毫秒数的问题,关闭 [#5224](https://github.com/tusen-ai/naive-ui/issues/5224)


### Feats

Expand Down
6 changes: 4 additions & 2 deletions src/time-picker/src/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import {
getTime,
getMinutes,
getHours,
getSeconds
getSeconds,
getMilliseconds
} from 'date-fns/esm'
import formatInTimeZone from 'date-fns-tz/formatInTimeZone'
import type { Locale } from 'date-fns'
Expand Down Expand Up @@ -671,7 +672,8 @@ export default defineComponent({
const newTime = set(mergedValue, {
hours: getHours(time),
minutes: getMinutes(time),
seconds: getSeconds(time)
seconds: getSeconds(time),
milliseconds: getMilliseconds(time)
})
doUpdateValue(getTime(newTime))
} else {
Expand Down

0 comments on commit 8c326c0

Please sign in to comment.