Skip to content

Commit 8feba0f

Browse files
committed
feat(date-parser): parse future time ranges
1 parent 2d8b129 commit 8feba0f

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/timeslice/utils/date-parser.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@ export function parseDateInput(value: string): DateRange {
1414
const start = parsed[0].start
1515
const end = parsed[0].end
1616

17-
const startDate = start?.date()
17+
let startDate = start?.date()
1818
let endDate = end?.date()
1919

2020
if (startDate && !endDate) {
2121
if (startDate < new Date()) {
2222
endDate = new Date()
2323
} else {
24-
endDate = new Date(
25-
startDate.getFullYear(),
26-
startDate.getMonth(),
27-
startDate.getDate(),
28-
23,
29-
59,
30-
59
31-
)
24+
endDate = startDate
25+
startDate = new Date()
3226
}
3327
}
3428

0 commit comments

Comments
 (0)