@bash-app/bash-common 1.14.0 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "1.14.0",
3
+ "version": "2.0.0",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,5 +1,5 @@
1
1
  import {DateType, DateValueType} from "react-tailwindcss-datepicker";
2
- import dayjs from "dayjs";
2
+ import dayjs, {Dayjs} from "dayjs";
3
3
  import dayjsUtc from "dayjs/plugin/utc";
4
4
  import dayjsTimeZone from "dayjs/plugin/timezone";
5
5
  import {DateTimeArgType} from "../definitions";
@@ -141,14 +141,13 @@ export function setTimeOnDate(date: DateType | Date | undefined, parsedTime: ITi
141
141
  return correctTimeOnDate;
142
142
  }
143
143
 
144
- export function ensureDateTimeIsLocalDateTime(dateArg: DateType | undefined): Date {
144
+ export function ensureDateTimeIsLocalDateTime(dateArg: DateType | Dayjs | undefined): Dayjs {
145
145
  if (dayjs(dateArg).isUTC()) {
146
146
  const dateLocalTimeZone = dayjs(dateArg);
147
- const date = dateLocalTimeZone.toDate();
148
- return date;
147
+ return dateLocalTimeZone;
149
148
  }
150
149
  else {
151
- return new Date(dateArg ?? Date.now());
150
+ return dayjs(dateArg ?? Date.now());
152
151
  }
153
152
  }
154
153