12345678910111213141516171819202122232425262728 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = getUTCDayOfYear;
- var _index = _interopRequireDefault(require("../../toDate/index.js"));
- var _index2 = _interopRequireDefault(require("../requiredArgs/index.js"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.
- // See issue: https://github.com/date-fns/date-fns/issues/376
- function getUTCDayOfYear(dirtyDate) {
- (0, _index2.default)(1, arguments);
- var date = (0, _index.default)(dirtyDate);
- var timestamp = date.getTime();
- date.setUTCMonth(0, 1);
- date.setUTCHours(0, 0, 0, 0);
- var startOfYearTimestamp = date.getTime();
- var difference = timestamp - startOfYearTimestamp;
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
- }
- module.exports = exports.default;
|