1234567891011121314151617181920212223242526272829303132333435 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = startOfUTCWeekYear;
- var _index = _interopRequireDefault(require("../toInteger/index.js"));
- var _index2 = _interopRequireDefault(require("../getUTCWeekYear/index.js"));
- var _index3 = _interopRequireDefault(require("../startOfUTCWeek/index.js"));
- var _index4 = _interopRequireDefault(require("../requiredArgs/index.js"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // 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 startOfUTCWeekYear(dirtyDate, dirtyOptions) {
- (0, _index4.default)(1, arguments);
- var options = dirtyOptions || {};
- var locale = options.locale;
- var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
- var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : (0, _index.default)(localeFirstWeekContainsDate);
- var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : (0, _index.default)(options.firstWeekContainsDate);
- var year = (0, _index2.default)(dirtyDate, dirtyOptions);
- var firstWeek = new Date(0);
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
- firstWeek.setUTCHours(0, 0, 0, 0);
- var date = (0, _index3.default)(firstWeek, dirtyOptions);
- return date;
- }
- module.exports = exports.default;
|