@valkyriestudios/utils 6.2.0 → 6.3.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/CHANGELOG.md +4 -0
- package/README.md +3 -0
- package/date/toUTC.js +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic
|
|
6
6
|
Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [6.3.0] - 2023-05-01
|
|
9
|
+
### Added
|
|
10
|
+
- date/toUTC (benchmark 1.000.000 opts in ~500ms)
|
|
11
|
+
|
|
8
12
|
## [6.2.0] - 2023-04-29
|
|
9
13
|
### Added
|
|
10
14
|
- date/nowUnix
|
package/README.md
CHANGED
|
@@ -278,6 +278,9 @@ isDate(new Date('December 17, 1995 03:24:00'); // TRUE
|
|
|
278
278
|
isDate('December 17, 1995 03:24:00'); // FALSE
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
+
- **toUTC(val:Date)**
|
|
282
|
+
Takes the passed date object and returns a new date object set for utc
|
|
283
|
+
|
|
281
284
|
- **nowUnix()**
|
|
282
285
|
Returns the current unix timestamp in seconds
|
|
283
286
|
|
package/date/toUTC.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = toUTC;
|
|
7
|
+
var _is = _interopRequireDefault(require("./is"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function toUTC(val) {
|
|
10
|
+
if (!(0, _is["default"])(val)) throw new Error('Date To UTC requires a date object');
|
|
11
|
+
return new Date(Date.UTC(val.getUTCFullYear(), val.getUTCMonth(), val.getUTCDate(), val.getUTCHours(), val.getUTCMinutes(), val.getUTCSeconds(), val.getUTCMilliseconds()));
|
|
12
|
+
}
|