@cellaware/utils 5.1.1 → 5.1.2

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/dist/util.d.ts CHANGED
@@ -2,6 +2,7 @@ export declare function sleep(ms: number): Promise<any>;
2
2
  export declare function removeMarkdownIndicators(input: string): string;
3
3
  export declare function removePrefixIndicators(input: string, prefixes: string[]): string;
4
4
  export declare function initDate(timeZone?: string): Date;
5
+ export declare function convertDateTimeZone(date: Date, timeZone: string): Date;
5
6
  export declare function isDaylightSavingTime(timeZone?: string): boolean;
6
7
  export declare function isLeapYear(timeZone?: string): boolean;
7
8
  export declare function getDaysInMonth(timeZone?: string): number;
package/dist/util.js CHANGED
@@ -31,6 +31,14 @@ export function initDate(timeZone) {
31
31
  return date;
32
32
  }
33
33
  }
34
+ export function convertDateTimeZone(date, timeZone) {
35
+ if (!!timeZone) {
36
+ return new Date(date.toLocaleString('en-US', { timeZone }));
37
+ }
38
+ else {
39
+ return date;
40
+ }
41
+ }
34
42
  export function isDaylightSavingTime(timeZone) {
35
43
  const date = initDate(timeZone);
36
44
  const jan = new Date(date.getFullYear(), 0, 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",