@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) • 672 B
text/typescript
import { DateRangeSelectType, isDateRangeSelectType } from '@prefecthq/prefect-design'
import { RouteParam, InvalidRouteParamValue } from '@prefecthq/vue-compositions'
import { LocationQueryValue } from 'vue-router'
export class DateRangeSelectTypeParam extends RouteParam<DateRangeSelectType> {
protected override parse(value: LocationQueryValue): DateRangeSelectType {
if (isDateRangeSelectType(value)) {
return value
}
throw new InvalidRouteParamValue()
}
protected override format(value: DateRangeSelectType): LocationQueryValue {
if (isDateRangeSelectType(value)) {
return value
}
throw new InvalidRouteParamValue()
}
}