noda-js-zod 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +5 -5
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -57,11 +57,11 @@ you use:
57
57
  import { tzdb } from "noda-js/tzdb/bundled"; // or a provider from noda-js/tzdb, noda-js/browser, ...
58
58
 
59
59
  const ZonedDateTimeSchema = NodaZ.ZonedDateTime(tzdb); // create once, reuse
60
- const meeting = ZonedDateTimeSchema.parse("2024-01-31T12:00:00+01 Europe/Paris");
61
- meeting.Zone.Id; // "Europe/Paris"
62
- ZonedDateTimeSchema.encode(meeting); // "2024-01-31T12:00:00+01 Europe/Paris"
60
+ const meeting = ZonedDateTimeSchema.parse("2024-01-31T12:00:00+01 Europe/Madrid");
61
+ meeting.Zone.Id; // "Europe/Madrid"
62
+ ZonedDateTimeSchema.encode(meeting); // "2024-01-31T12:00:00+01 Europe/Madrid"
63
63
 
64
- NodaZ.DateTimeZone(tzdb).parse("America/New_York"); // tzdb.get("America/New_York")
64
+ NodaZ.DateTimeZone(tzdb).parse("America/New_York"); // tzdb.Get("America/New_York")
65
65
  ```
66
66
 
67
67
  To read zones written by .NET's `BclDateTimeZone` (Windows IDs such as `AUS Eastern Standard Time`), pass a provider
@@ -160,7 +160,7 @@ booking.stay.Length; // number of days
160
160
 
161
161
  JSON.stringify(Booking.encode(booking)); // back to the wire format
162
162
 
163
- const result = Booking.safeParse({ at: "2024-01-31T12:00:00Z", nights: ["2024-02-30"], stay: { start: "2024-02-01" }, zone: "Europe/Paris" });
163
+ const result = Booking.safeParse({ at: "2024-01-31T12:00:00Z", nights: ["2024-02-30"], stay: { start: "2024-02-01" }, zone: "Europe/Madrid" });
164
164
  console.log(z.prettifyError(result.error!));
165
165
  // ✖ The day 30 is out of range in month 2 of year 2024. Value being parsed: '2024-02-30'.
166
166
  // → at nights[0]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noda-js-zod",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Zod schemas for noda-js: parse and validate NodaTime's JSON formats into noda-js values (NodaZ.Instant, ...).",
5
5
  "keywords": [
6
6
  "nodatime",
@@ -40,12 +40,12 @@
40
40
  "provenance": true
41
41
  },
42
42
  "scripts": {
43
- "build": "tsc -b",
44
- "prepack": "pwsh -NoProfile -Command \"Copy-Item ../../LICENSE.txt, ../../NOTICE.txt .\"",
43
+ "build": "pwsh -NoProfile -ExecutionPolicy Bypass -File ../../scripts/clean.ps1 dist && tsc -b",
44
+ "prepack": "pwsh -NoProfile -ExecutionPolicy Bypass -Command \"Copy-Item ../../LICENSE.txt, ../../NOTICE.txt .\"",
45
45
  "check:package": "publint --strict && attw --pack . --profile esm-only"
46
46
  },
47
47
  "peerDependencies": {
48
- "noda-js": "^0.1.0",
48
+ "noda-js": "^0.2.0",
49
49
  "zod": "^4.1.0"
50
50
  }
51
51
  }