-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Package both src and dist the in NPM module
Support importing ES6 modules in the client code.
- Loading branch information
Showing
4 changed files
with
33 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ | |
] | ||
}, | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"src" | ||
], | ||
"jest": { | ||
"roots": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
function getUnixTimeFromUTC ({ year, month, day, hours, minutes, seconds = 0, milliseconds = 0 }) { | ||
return Date.UTC(year, month - 1, day, hours, minutes, seconds, milliseconds) | ||
} | ||
|
||
function getUTCTime (date) { | ||
const year = date.getUTCFullYear() | ||
const month = date.getUTCMonth() + 1 | ||
const day = date.getUTCDate() | ||
const hours = date.getUTCHours() | ||
const minutes = date.getUTCMinutes() | ||
const seconds = date.getUTCSeconds() || 0 | ||
const milliseconds = date.getUTCMilliseconds() || 0 | ||
return { year, month, day, hours, minutes, seconds, milliseconds } | ||
} | ||
|
||
function getLocalTime (date) { | ||
const year = date.getFullYear() | ||
const month = date.getMonth() + 1 | ||
const day = date.getDate() | ||
const hours = date.getHours() | ||
const minutes = date.getMinutes() | ||
const seconds = date.getSeconds() | ||
const milliseconds = date.getMilliseconds() | ||
return { year, month, day, hours, minutes, seconds, milliseconds } | ||
} | ||
|
||
export { getUnixTimeFromUTC, getUTCTime, getLocalTime } |