mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
feat: 补充datetimerange单测
This commit is contained in:
parent
cd10e3d1ee
commit
92ab9513d3
@ -704,7 +704,6 @@ export class DateRangePicker extends React.Component<
|
||||
: curTimeFormat
|
||||
});
|
||||
}
|
||||
|
||||
if (prevProps.value !== value) {
|
||||
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
||||
value,
|
||||
@ -917,6 +916,7 @@ export class DateRangePicker extends React.Component<
|
||||
|
||||
handleStartDateChange(newValue: moment.Moment) {
|
||||
const {timeFormat, minDate, inputFormat, displayFormat, type} = this.props;
|
||||
const {curTimeFormat} = this.state;
|
||||
let {startDate, endDateOpenedFirst} = this.state;
|
||||
if (minDate && newValue.isBefore(minDate)) {
|
||||
newValue = minDate;
|
||||
@ -924,7 +924,7 @@ export class DateRangePicker extends React.Component<
|
||||
const date = this.filterDate(
|
||||
newValue,
|
||||
startDate || minDate,
|
||||
timeFormat,
|
||||
curTimeFormat || timeFormat,
|
||||
'start'
|
||||
);
|
||||
const newState = {
|
||||
@ -1080,7 +1080,6 @@ export class DateRangePicker extends React.Component<
|
||||
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
||||
newValue = minDate;
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
startDate: newValue,
|
||||
|
@ -91,12 +91,12 @@ test('Renderer:datetimeRange with default', async () => {
|
||||
});
|
||||
|
||||
// 2. timeFormat 控制可以选择秒
|
||||
test('Renderer:datetimeRange with timeFormat', async () => {
|
||||
test('Renderer:datetimeRange with displayFormat', async () => {
|
||||
const {container, start, end}: any = await setup([
|
||||
{
|
||||
type: 'input-datetime-range',
|
||||
name: 'select',
|
||||
timeFormat: 'HH:mm:ss',
|
||||
displayFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
label: '日期时间范围',
|
||||
value: '1668115260,1668722939'
|
||||
}
|
||||
@ -120,7 +120,6 @@ test('Renderer:datetimeRange with timeFormat', async () => {
|
||||
{
|
||||
type: 'input-datetime-range',
|
||||
name: 'select',
|
||||
timeFormat: 'HH:mm:ss',
|
||||
inputFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
label: '日期时间范围',
|
||||
value: '1667404800,1669270456'
|
||||
|
Loading…
Reference in New Issue
Block a user