@powfix/core-js 0.13.15 → 0.13.16

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,6 +1,5 @@
1
1
  import { MomentInput, RelativeTimeSpec } from "moment";
2
2
  import { DATE } from "../constants/DATE";
3
- export type DateUtilsFrom = number | bigint | string | Date;
4
3
  export declare class DateUtils {
5
4
  static isPositiveInteger(value: unknown, strict?: boolean): boolean;
6
5
  static isMilliseconds(value: unknown, strict?: boolean): boolean;
@@ -8,10 +7,10 @@ export declare class DateUtils {
8
7
  static isUnix(value: unknown, strict?: boolean): boolean;
9
8
  static isISO8601(value: unknown): boolean;
10
9
  static isValid(value: unknown, format?: DATE.FORMAT, strict?: boolean): boolean;
11
- static from(value: DateUtilsFrom, format?: DATE.FORMAT, strict?: boolean): Date;
12
- static fromUnix(value: DateUtilsFrom, strict?: boolean): Date;
13
- static fromSeconds(value: DateUtilsFrom, strict?: boolean): Date;
14
- static fromMilliseconds(value: DateUtilsFrom, strict?: boolean): Date;
10
+ static from(value: unknown, format?: DATE.FORMAT, strict?: boolean): Date;
11
+ static fromUnix(value: unknown, strict?: boolean): Date;
12
+ static fromSeconds(value: unknown, strict?: boolean): Date;
13
+ static fromMilliseconds(value: unknown, strict?: boolean): Date;
15
14
  static fromISO8601(value: string): Date;
16
15
  static relativeDate: (input: MomentInput, base?: MomentInput) => string;
17
16
  static setLocale: (language: DateUtils.Locale) => void;
@@ -83,9 +83,9 @@ class DateUtils {
83
83
  throw new Error(`no option to convert value to date`);
84
84
  }
85
85
  switch (format) {
86
- case DATE_1.DATE.FORMAT.UNIX: return new Date(value * 1000);
87
- case DATE_1.DATE.FORMAT.SECONDS: return new Date(value * 1000);
88
- case DATE_1.DATE.FORMAT.MILLISECONDS: return new Date(value);
86
+ case DATE_1.DATE.FORMAT.UNIX: return new Date(Number(value) * 1000);
87
+ case DATE_1.DATE.FORMAT.SECONDS: return new Date(Number(value) * 1000);
88
+ case DATE_1.DATE.FORMAT.MILLISECONDS: return new Date(Number(value));
89
89
  case DATE_1.DATE.FORMAT.ISO_8601: return new Date(value);
90
90
  default: {
91
91
  throw new Error(`unknown format: ${format}(${(_a = DATE_1.DATE.FORMAT.toString(format)) !== null && _a !== void 0 ? _a : 'unknown'})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.13.15",
3
+ "version": "0.13.16",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,