add minimum duration for DOM parser
This commit is contained in:
parent
401ff587e2
commit
8458ae0b69
|
@ -20,9 +20,11 @@ const parseDate = (timeText = '') => {
|
|||
const normalizedEndTime = endTime.isValid() ? endTime : dayjs(new Date())
|
||||
const { start, duration } = parseDates(normalizedStartTime, normalizedEndTime)
|
||||
|
||||
const minimumDuration = { ...duration, minutes: duration.minutes || 120 }
|
||||
|
||||
return {
|
||||
start,
|
||||
duration,
|
||||
duration: minimumDuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ describe(parseUsingDOM, () => {
|
|||
})
|
||||
|
||||
|
||||
it('should return duration based on current time if ' +
|
||||
it('should return duration of minimum 120 minutes if ' +
|
||||
'no time data is found', () => {
|
||||
const now = new Date('2020-01-01 12:00:00')
|
||||
const spy = jest
|
||||
|
@ -95,7 +95,7 @@ describe(parseUsingDOM, () => {
|
|||
|
||||
spy.mockRestore()
|
||||
|
||||
expect(duration).to.deep.equal({ minutes: 0 })
|
||||
expect(duration).to.deep.equal({ minutes: 120 })
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue