1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = addSeconds;
|
7 |
|
8 | var _index = _interopRequireDefault(require("../_lib/toInteger/index.js"));
|
9 |
|
10 | var _index2 = _interopRequireDefault(require("../addMilliseconds/index.js"));
|
11 |
|
12 | var _index3 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
|
13 |
|
14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15 |
|
16 | /**
|
17 | * @name addSeconds
|
18 | * @category Second Helpers
|
19 | * @summary Add the specified number of seconds to the given date.
|
20 | *
|
21 | * @description
|
22 | * Add the specified number of seconds to the given date.
|
23 | *
|
24 | * ### v2.0.0 breaking changes:
|
25 | *
|
26 | * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
27 | *
|
28 | * @param {Date|Number} date - the date to be changed
|
29 | * @param {Number} amount - the amount of seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
30 | * @returns {Date} the new date with the seconds added
|
31 | * @throws {TypeError} 2 arguments required
|
32 | *
|
33 | * @example
|
34 | * // Add 30 seconds to 10 July 2014 12:45:00:
|
35 | * var result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)
|
36 | * //=> Thu Jul 10 2014 12:45:30
|
37 | */
|
38 | function addSeconds(dirtyDate, dirtyAmount) {
|
39 | (0, _index3.default)(2, arguments);
|
40 | var amount = (0, _index.default)(dirtyAmount);
|
41 | return (0, _index2.default)(dirtyDate, amount * 1000);
|
42 | }
|
43 |
|
44 | module.exports = exports.default; |
\ | No newline at end of file |