I have a method in my react-native-library that takes "from" and "to" Date as input.
I want to add a restriction in the below code.
"to" Date should always be greater than "from" Date.
How and where can i add this restriction??
const getData: getDataMethod = async ( //main method identifier, options) => { const option = prepareInput(options) return option}const prepareInput = (options: InputOptions) => { //prepareInput function const limit = options.limit ?? 0 const ascending = options.ascending ?? true const from = dateToString(options.from) const to = dateToString(options.to) return { limit, ascending, from, to }}const dateToString = (date?: Date | null): string => { //date to String function return date ? date.toISOString() : new Date(0).toISOString()}export type InputOptions = { //type declaration from?: Date to?: Date limit?: Number ascending?: boolean};