feat: resolved type error

This commit is contained in:
=
2025-03-15 21:32:52 +05:30
parent 0b71f7f297
commit 7dffc08eba
30 changed files with 46 additions and 31 deletions
+15
View File
@@ -0,0 +1,15 @@
import msFn, { StringValue } from "ms";
import { BadRequestError } from "../errors";
export const ms = (val: string) => {
if (typeof val !== "string") {
throw new BadRequestError({ message: `Date must be string` });
}
try {
return msFn(val as StringValue);
} catch {
throw new BadRequestError({ message: `Invalid date format string: ${val}` });
}
};