|
@ -1,5 +1,5 @@ |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { allOffsets, pastOffsets, customDateRange } from "../utils/date-range"; |
|
|
|
|
|
|
|
|
import { allOffsets, pastOffsets, CustomDateRange } from "../utils/date-range"; |
|
|
import type { DateRange } from "../utils/date-range"; |
|
|
import type { DateRange } from "../utils/date-range"; |
|
|
import { formatFormTime } from "../utils/time"; |
|
|
import { formatFormTime } from "../utils/time"; |
|
|
|
|
|
|
|
@ -11,12 +11,12 @@ |
|
|
|
|
|
|
|
|
let rangeOptions: DateRange[]; |
|
|
let rangeOptions: DateRange[]; |
|
|
let selected = value.name; |
|
|
let selected = value.name; |
|
|
let [customMin, customMax] = pastOffsets[0].calculate(new Date()).map(d => formatFormTime(d)); |
|
|
|
|
|
|
|
|
let [customMin, customMax] = (value || pastOffsets[0]).calculate(new Date()).map(d => formatFormTime(d)); |
|
|
|
|
|
|
|
|
$: rangeOptions = noFuture ? pastOffsets : allOffsets; |
|
|
$: rangeOptions = noFuture ? pastOffsets : allOffsets; |
|
|
$: { |
|
|
$: { |
|
|
if (selected === "Specific Dates") { |
|
|
if (selected === "Specific Dates") { |
|
|
value = customDateRange(new Date(customMin), new Date(customMax)) |
|
|
|
|
|
|
|
|
value = new CustomDateRange(new Date(customMin), new Date(customMax)) |
|
|
} else { |
|
|
} else { |
|
|
value = rangeOptions.find(v => v.name === selected); |
|
|
value = rangeOptions.find(v => v.name === selected); |
|
|
if (value != null) { |
|
|
if (value != null) { |
|
|