@verifiedinc-public/shared-ui-elements 1.0.0 → 1.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,3 @@
1
1
  import * as zod from 'zod';
2
2
  export declare const USDateSchema: zod.ZodEffects<zod.ZodString, string, string>;
3
+ export declare const getDateSchemaWithPastValidation: (message: string) => zod.ZodEffects<zod.ZodDate, Date, Date>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "keywords": [],
@@ -8,3 +8,11 @@ export const USDateSchema = zod.string().refine((value: string) => {
8
8
  }
9
9
  return false;
10
10
  }, 'Date is invalid');
11
+
12
+ export const getDateSchemaWithPastValidation = (
13
+ message: string,
14
+ ): zod.ZodEffects<zod.ZodDate, Date, Date> => {
15
+ return zod.date().refine((date) => date.getTime() < Date.now(), {
16
+ message,
17
+ });
18
+ };