@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
21 lines (17 loc) • 720 B
text/typescript
import { DateRangeSelectAroundUnit, isDateRangeSelectAroundUnit } from '@prefecthq/prefect-design'
import { RouteParam, InvalidRouteParamValue } from '@prefecthq/vue-compositions'
import { LocationQueryValue } from 'vue-router'
export class DateRangeSelectAroundUnitParam extends RouteParam<DateRangeSelectAroundUnit> {
protected override parse(value: LocationQueryValue): DateRangeSelectAroundUnit {
if (isDateRangeSelectAroundUnit(value)) {
return value
}
throw new InvalidRouteParamValue()
}
protected override format(value: DateRangeSelectAroundUnit): LocationQueryValue {
if (isDateRangeSelectAroundUnit(value)) {
return value
}
throw new InvalidRouteParamValue()
}
}