demo(time-picker): add default value for range picker case (#51413)

This commit is contained in:
NathanLao 2024-11-06 21:51:36 -08:00 committed by GitHub
parent 2974f27c11
commit d6f1b1e063
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 66 additions and 9 deletions

View File

@ -14645,7 +14645,7 @@ Array [
date-range="start"
placeholder="Start time"
size="10"
value=""
value="12:08:23"
/>
</div>
<div
@ -14685,7 +14685,7 @@ Array [
date-range="end"
placeholder="End time"
size="10"
value=""
value="12:08:23"
/>
</div>
<div
@ -14718,6 +14718,31 @@ Array [
</svg>
</span>
</span>
<span
class="ant-picker-clear"
role="button"
>
<span
aria-label="close-circle"
class="anticon anticon-close-circle"
role="img"
>
<svg
aria-hidden="true"
data-icon="close-circle"
fill="currentColor"
fill-rule="evenodd"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"
/>
</svg>
</span>
</span>
</div>,
<div
class="ant-picker-dropdown ant-slide-up-appear ant-slide-up-appear-prepare ant-slide-up ant-picker-dropdown-range ant-picker-dropdown-placement-bottomLeft"
@ -14874,7 +14899,7 @@ Array [
</div>
</li>
<li
class="ant-picker-time-panel-cell"
class="ant-picker-time-panel-cell ant-picker-time-panel-cell-selected"
data-value="12"
>
<div
@ -15079,7 +15104,7 @@ Array [
</div>
</li>
<li
class="ant-picker-time-panel-cell"
class="ant-picker-time-panel-cell ant-picker-time-panel-cell-selected"
data-value="8"
>
<div
@ -15834,7 +15859,7 @@ Array [
</div>
</li>
<li
class="ant-picker-time-panel-cell"
class="ant-picker-time-panel-cell ant-picker-time-panel-cell-selected"
data-value="23"
>
<div
@ -16218,7 +16243,6 @@ Array [
>
<button
class="ant-btn ant-btn-primary ant-btn-color-primary ant-btn-variant-solid ant-btn-sm"
disabled=""
type="button"
>
<span>

View File

@ -534,7 +534,7 @@ exports[`renders components/time-picker/demo/range-picker.tsx correctly 1`] = `
date-range="start"
placeholder="Start time"
size="10"
value=""
value="12:08:23"
/>
</div>
<div
@ -574,7 +574,7 @@ exports[`renders components/time-picker/demo/range-picker.tsx correctly 1`] = `
date-range="end"
placeholder="End time"
size="10"
value=""
value="12:08:23"
/>
</div>
<div
@ -607,6 +607,31 @@ exports[`renders components/time-picker/demo/range-picker.tsx correctly 1`] = `
</svg>
</span>
</span>
<span
class="ant-picker-clear"
role="button"
>
<span
aria-label="close-circle"
class="anticon anticon-close-circle"
role="img"
>
<svg
aria-hidden="true"
data-icon="close-circle"
fill="currentColor"
fill-rule="evenodd"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"
/>
</svg>
</span>
</span>
</div>
`;

View File

@ -1,6 +1,14 @@
import React from 'react';
import { TimePicker } from 'antd';
import dayjs from 'dayjs';
const App: React.FC = () => <TimePicker.RangePicker />;
const format = 'HH:mm:ss';
const App: React.FC = () => {
const startTime = dayjs('12:08:23', 'HH:mm:ss');
const endTime = dayjs('12:08:23', 'HH:mm:ss');
return <TimePicker.RangePicker defaultValue={[startTime, endTime]} format={format} />;
};
export default App;