refactor: enforce frontend view model boundaries
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { calendarDate } from "./calendar.schema";
|
||||
|
||||
function isValidPeriod(from: null | string, to: null | string) {
|
||||
return (
|
||||
[from, to].every(
|
||||
date => date === null || calendarDate.safeParse(date).success,
|
||||
)
|
||||
&& (!from || !to || from <= to)
|
||||
);
|
||||
}
|
||||
|
||||
export { isValidPeriod };
|
||||
Reference in New Issue
Block a user