Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/examples/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export default () => {
{...sharedLocale}
// picker="week"
// multiple
format="YYYY-MM-DD"
showTime
defaultValue={[
dayjs(),
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useTimeInfo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { warning } from 'rc-util';
import * as React from 'react';
import type { GenerateConfig } from '../generate';
import { leftPad } from '../utils/miscUtil';
import type { DisabledTimes, SharedTimeProps } from '../interface';
import { findValidateTime } from '../PickerPanel/TimePanel/TimePanelBody/util';
import { leftPad } from '../utils/miscUtil';

export type Unit<ValueType = number | string> = {
label: React.ReactText;
Expand Down Expand Up @@ -96,7 +96,7 @@ export default function useTimeInfo<DateType extends object = any>(
}

// ========================== Show ==========================
let mergedShowHour = checkShow(format, ['H', 'LT', 'LLL'], showHour);
let mergedShowHour = checkShow(format, ['H', 'h', 'k', 'LT', 'LLL'], showHour);
let mergedShowMinute = checkShow(format, ['m', 'LT', 'LLL'], showMinute);
let mergedShowSecond = checkShow(format, ['s', 'LTS'], showSecond);
const mergedShowMillisecond = checkShow(format, ['SSS'], showMillisecond);
Expand Down
9 changes: 9 additions & 0 deletions tests/picker.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1319,4 +1319,13 @@ describe('Picker.Basic', () => {
expect.anything(),
);
});

it('showTime kk format', () => {
const { container } = render(
<DayPicker picker="time" defaultValue={getDay('2000-01-01 00:23:00')} format="kk:mm" open />,
);
expect(container.querySelector('input')).toHaveValue('24:23');

expect(document.querySelectorAll('.rc-picker-time-panel-column')).toHaveLength(2);
});
});