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
|
: curTimeFormat
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevProps.value !== value) {
|
if (prevProps.value !== value) {
|
||||||
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
const {startDate, endDate} = DateRangePicker.unFormatValue(
|
||||||
value,
|
value,
|
||||||
@ -917,6 +916,7 @@ export class DateRangePicker extends React.Component<
|
|||||||
|
|
||||||
handleStartDateChange(newValue: moment.Moment) {
|
handleStartDateChange(newValue: moment.Moment) {
|
||||||
const {timeFormat, minDate, inputFormat, displayFormat, type} = this.props;
|
const {timeFormat, minDate, inputFormat, displayFormat, type} = this.props;
|
||||||
|
const {curTimeFormat} = this.state;
|
||||||
let {startDate, endDateOpenedFirst} = this.state;
|
let {startDate, endDateOpenedFirst} = this.state;
|
||||||
if (minDate && newValue.isBefore(minDate)) {
|
if (minDate && newValue.isBefore(minDate)) {
|
||||||
newValue = minDate;
|
newValue = minDate;
|
||||||
@ -924,7 +924,7 @@ export class DateRangePicker extends React.Component<
|
|||||||
const date = this.filterDate(
|
const date = this.filterDate(
|
||||||
newValue,
|
newValue,
|
||||||
startDate || minDate,
|
startDate || minDate,
|
||||||
timeFormat,
|
curTimeFormat || timeFormat,
|
||||||
'start'
|
'start'
|
||||||
);
|
);
|
||||||
const newState = {
|
const newState = {
|
||||||
@ -1080,7 +1080,6 @@ export class DateRangePicker extends React.Component<
|
|||||||
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
||||||
newValue = minDate;
|
newValue = minDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
startDate: newValue,
|
startDate: newValue,
|
||||||
|
@ -91,12 +91,12 @@ test('Renderer:datetimeRange with default', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 2. timeFormat 控制可以选择秒
|
// 2. timeFormat 控制可以选择秒
|
||||||
test('Renderer:datetimeRange with timeFormat', async () => {
|
test('Renderer:datetimeRange with displayFormat', async () => {
|
||||||
const {container, start, end}: any = await setup([
|
const {container, start, end}: any = await setup([
|
||||||
{
|
{
|
||||||
type: 'input-datetime-range',
|
type: 'input-datetime-range',
|
||||||
name: 'select',
|
name: 'select',
|
||||||
timeFormat: 'HH:mm:ss',
|
displayFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
label: '日期时间范围',
|
label: '日期时间范围',
|
||||||
value: '1668115260,1668722939'
|
value: '1668115260,1668722939'
|
||||||
}
|
}
|
||||||
@ -120,7 +120,6 @@ test('Renderer:datetimeRange with timeFormat', async () => {
|
|||||||
{
|
{
|
||||||
type: 'input-datetime-range',
|
type: 'input-datetime-range',
|
||||||
name: 'select',
|
name: 'select',
|
||||||
timeFormat: 'HH:mm:ss',
|
|
||||||
inputFormat: 'YYYY-MM-DD HH:mm:ss',
|
inputFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
label: '日期时间范围',
|
label: '日期时间范围',
|
||||||
value: '1667404800,1669270456'
|
value: '1667404800,1669270456'
|
||||||
|
Loading…
Reference in New Issue
Block a user