@leancodepl/api-date-dayjs 8.3.5 → 8.3.6

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.
package/index.cjs.js CHANGED
@@ -23,6 +23,9 @@ function toApiTime(time) {
23
23
  }
24
24
 
25
25
  function fromApiDate(date) {
26
+ if (!date) {
27
+ return undefined;
28
+ }
26
29
  return dayjs(date);
27
30
  }
28
31
 
@@ -34,6 +37,9 @@ dayjs.extend(utc);
34
37
  }
35
38
 
36
39
  function toApiDate(date) {
40
+ if (!date) {
41
+ return undefined;
42
+ }
37
43
  return dropLocalOffset(date).startOf("day").format("YYYY-MM-DD");
38
44
  }
39
45
 
package/index.esm.js CHANGED
@@ -21,6 +21,9 @@ function toApiTime(time) {
21
21
  }
22
22
 
23
23
  function fromApiDate(date) {
24
+ if (!date) {
25
+ return undefined;
26
+ }
24
27
  return dayjs(date);
25
28
  }
26
29
 
@@ -32,6 +35,9 @@ dayjs.extend(utc);
32
35
  }
33
36
 
34
37
  function toApiDate(date) {
38
+ if (!date) {
39
+ return undefined;
40
+ }
35
41
  return dropLocalOffset(date).startOf("day").format("YYYY-MM-DD");
36
42
  }
37
43
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@leancodepl/api-date-dayjs",
3
- "version": "8.3.5",
3
+ "version": "8.3.6",
4
4
  "license": "Apache-2.0",
5
5
  "dependencies": {
6
- "@leancodepl/api-date": "8.3.5",
7
- "@leancodepl/api-date-utils": "8.3.5",
6
+ "@leancodepl/api-date": "8.3.6",
7
+ "@leancodepl/api-date-utils": "8.3.6",
8
8
  "dayjs": ">=1.9.0"
9
9
  },
10
10
  "devDependencies": {
@@ -1,3 +1,4 @@
1
1
  import dayjs from "dayjs";
2
2
  import type { ApiDateOnly } from "@leancodepl/api-date";
3
3
  export declare function fromApiDate(date: ApiDateOnly): dayjs.Dayjs;
4
+ export declare function fromApiDate(date: ApiDateOnly | undefined): dayjs.Dayjs | undefined;
@@ -1,3 +1,4 @@
1
1
  import dayjs from "dayjs";
2
2
  import type { ApiDateOnly } from "@leancodepl/api-date";
3
3
  export declare function toApiDate(date: dayjs.Dayjs): ApiDateOnly;
4
+ export declare function toApiDate(date: dayjs.Dayjs | undefined): ApiDateOnly | undefined;