import { z } from "zod";
const durationSchema = z
.object({
years: z.number().optional(),
months: z.number().optional(),
weeks: z.number().optional(),
days: z.number().optional(),
hours: z.number().optional(),
minutes: z.number().optional(),
seconds: z.number().optional(),
})
.optional();
export const formatParams = z.object({
datetime: z
.string({
description: "The ISO 8601 Date string to format.",
})
.describe("The ISO 8601 Date string to format."),
format: z.string({
description:
"The Unicode Technical Standard #35 format to use for the date.",
}),
});
export const addParams = z.object({
datetime: z.string({
description: "The ISO 8601 Date string to add the duration to.",
}),
duration: durationSchema,
});
export const subtractParams = z.object({
datetime: z.string({
description: "The ISO 8601 Date string to subtract the duration from.",
}),
duration: durationSchema,
});
export const differenceParams = z.object({
datetimeFrom: z.string({
description: "The ISO 8601 Date string to subtract the duration from.",
}),
datetimeTo: z.string({
description: "The ISO 8601 Date string to subtract the duration to.",
}),
unit: z
.enum(["seconds", "minutes", "hours", "days", "weeks", "months", "years"])
.describe("The unit of the difference."),
});
export const compareParams = z.object({
firstDatetime: z
.string({ description: "The first ISO 8601 Date Time to check." })
.describe("The first ISO 8601 Date Time to check."),
secondDatetime: z
.string({ description: "The second ISO 8601 Date Time to check." })
.describe("The second ISO 8601 Date Time to check."),
operator: z
.enum(["after", "before", "equal"])
.describe("The operator to use."),
});
export type TFormatParams = z.infer<typeof formatParams>;
export type TAddParams = z.infer<typeof addParams>;
export type TSubtractParams = z.infer<typeof subtractParams>;
export type TDifferenceParams = z.infer<typeof differenceParams>;
export type TCompareParams = z.infer<typeof compareParams>;