@js-joda/extra 0.7.1 → 0.9.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 +3 -1
- package/dist/js-joda-extra.esm.js +379 -3
- package/dist/js-joda-extra.esm.js.map +1 -1
- package/dist/js-joda-extra.js +636 -452
- package/dist/js-joda-extra.js.map +1 -1
- package/dist/js-joda-extra.min.js +3 -3
- package/package.json +5 -6
- package/src/DayOfMonth.js +487 -0
- package/src/DayOfYear.js +472 -0
- package/src/Interval.js +0 -1
- package/src/_init.js +4 -0
- package/src/js-joda-extra.js +4 -0
- package/src/plug.js +4 -0
- package/typings/js-joda-extra.d.ts +46 -1
- package/src/license-preamble.js +0 -3
package/dist/js-joda-extra.js
CHANGED
|
@@ -1,523 +1,707 @@
|
|
|
1
|
-
//! @version @js-joda/extra - 0.
|
|
2
|
-
//! @copyright (c) 2015-
|
|
1
|
+
//! @version @js-joda/extra - 0.9.0
|
|
2
|
+
//! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
|
|
3
3
|
//! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
4
|
//! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
|
|
6
|
-
(function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/******/ if(installedModules[moduleId]) {
|
|
25
|
-
/******/ return installedModules[moduleId].exports;
|
|
26
|
-
/******/ }
|
|
27
|
-
/******/ // Create a new module (and put it into the cache)
|
|
28
|
-
/******/ var module = installedModules[moduleId] = {
|
|
29
|
-
/******/ i: moduleId,
|
|
30
|
-
/******/ l: false,
|
|
31
|
-
/******/ exports: {}
|
|
32
|
-
/******/ };
|
|
33
|
-
/******/
|
|
34
|
-
/******/ // Execute the module function
|
|
35
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
36
|
-
/******/
|
|
37
|
-
/******/ // Flag the module as loaded
|
|
38
|
-
/******/ module.l = true;
|
|
39
|
-
/******/
|
|
40
|
-
/******/ // Return the exports of the module
|
|
41
|
-
/******/ return module.exports;
|
|
42
|
-
/******/ }
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
46
|
-
/******/ __webpack_require__.m = modules;
|
|
47
|
-
/******/
|
|
48
|
-
/******/ // expose the module cache
|
|
49
|
-
/******/ __webpack_require__.c = installedModules;
|
|
50
|
-
/******/
|
|
51
|
-
/******/ // define getter function for harmony exports
|
|
52
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
53
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
54
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
55
|
-
/******/ }
|
|
56
|
-
/******/ };
|
|
57
|
-
/******/
|
|
58
|
-
/******/ // define __esModule on exports
|
|
59
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
60
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
61
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
62
|
-
/******/ }
|
|
63
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
64
|
-
/******/ };
|
|
65
|
-
/******/
|
|
66
|
-
/******/ // create a fake namespace object
|
|
67
|
-
/******/ // mode & 1: value is a module id, require it
|
|
68
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
69
|
-
/******/ // mode & 4: return value when already ns object
|
|
70
|
-
/******/ // mode & 8|1: behave like require
|
|
71
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
72
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
73
|
-
/******/ if(mode & 8) return value;
|
|
74
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
75
|
-
/******/ var ns = Object.create(null);
|
|
76
|
-
/******/ __webpack_require__.r(ns);
|
|
77
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
78
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
79
|
-
/******/ return ns;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
83
|
-
/******/ __webpack_require__.n = function(module) {
|
|
84
|
-
/******/ var getter = module && module.__esModule ?
|
|
85
|
-
/******/ function getDefault() { return module['default']; } :
|
|
86
|
-
/******/ function getModuleExports() { return module; };
|
|
87
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
88
|
-
/******/ return getter;
|
|
89
|
-
/******/ };
|
|
90
|
-
/******/
|
|
91
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
92
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
93
|
-
/******/
|
|
94
|
-
/******/ // __webpack_public_path__
|
|
95
|
-
/******/ __webpack_require__.p = "";
|
|
96
|
-
/******/
|
|
97
|
-
/******/
|
|
98
|
-
/******/ // Load entry module and return exports
|
|
99
|
-
/******/ return __webpack_require__(__webpack_require__.s = "./src/js-joda-extra.js");
|
|
100
|
-
/******/ })
|
|
101
|
-
/************************************************************************/
|
|
102
|
-
/******/ ({
|
|
103
|
-
|
|
104
|
-
/***/ "./src/Interval.js":
|
|
105
|
-
/*!*************************!*\
|
|
106
|
-
!*** ./src/Interval.js ***!
|
|
107
|
-
\*************************/
|
|
108
|
-
/*! exports provided: Interval, _init */
|
|
109
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
110
|
-
|
|
111
|
-
"use strict";
|
|
112
|
-
__webpack_require__.r(__webpack_exports__);
|
|
113
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interval", function() { return Interval; });
|
|
114
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_init", function() { return _init; });
|
|
115
|
-
/* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js-joda/core */ "@js-joda/core");
|
|
116
|
-
/* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
117
|
-
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assert */ "./src/assert.js");
|
|
118
|
-
/*
|
|
119
|
-
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
120
|
-
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
121
|
-
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var Interval = function () {
|
|
126
|
-
Interval.of = function of(startInstant, endInstantOrDuration) {
|
|
127
|
-
if (endInstantOrDuration instanceof _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"]) {
|
|
128
|
-
return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
|
|
129
|
-
} else {
|
|
130
|
-
return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
|
|
131
|
-
}
|
|
132
|
-
};
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@js-joda/core')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports', '@js-joda/core'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSJodaExtra = {}, global.JSJoda));
|
|
10
|
+
})(this, (function (exports, core) { 'use strict';
|
|
11
|
+
|
|
12
|
+
function _inheritsLoose(subClass, superClass) {
|
|
13
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
14
|
+
subClass.prototype.constructor = subClass;
|
|
15
|
+
|
|
16
|
+
_setPrototypeOf(subClass, superClass);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _setPrototypeOf(o, p) {
|
|
20
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
21
|
+
o.__proto__ = p;
|
|
22
|
+
return o;
|
|
23
|
+
};
|
|
133
24
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(endExclusive, 'endExclusive');
|
|
137
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
|
|
138
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(endExclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'endExclusive');
|
|
25
|
+
return _setPrototypeOf(o, p);
|
|
26
|
+
}
|
|
139
27
|
|
|
140
|
-
|
|
141
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
30
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
31
|
+
*/
|
|
32
|
+
function requireNonNull(value, parameterName) {
|
|
33
|
+
if (value == null) {
|
|
34
|
+
throw new core.NullPointerException(parameterName + " must not be null");
|
|
142
35
|
}
|
|
143
36
|
|
|
144
|
-
return
|
|
145
|
-
}
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function requireInstance(value, _class, parameterName) {
|
|
40
|
+
if (!(value instanceof _class)) {
|
|
41
|
+
throw new core.IllegalArgumentException(parameterName + " must be an instance of " + (_class.name ? _class.name : _class) + (value && value.constructor && value.constructor.name ? ", but is " + value.constructor.name : ''));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
146
46
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(startInclusive, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'startInclusive');
|
|
151
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(duration, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Duration"], 'duration');
|
|
47
|
+
var MathUtil$1 = core._.MathUtil;
|
|
48
|
+
var DayOfMonth = function (_TemporalAccessor) {
|
|
49
|
+
_inheritsLoose(DayOfMonth, _TemporalAccessor);
|
|
152
50
|
|
|
153
|
-
|
|
154
|
-
|
|
51
|
+
DayOfMonth.now = function now(zoneIdOrClock) {
|
|
52
|
+
switch (arguments.length) {
|
|
53
|
+
case 0:
|
|
54
|
+
return DayOfMonth.now0();
|
|
55
|
+
|
|
56
|
+
case 1:
|
|
57
|
+
requireNonNull(zoneIdOrClock, 'clockOrZone');
|
|
58
|
+
|
|
59
|
+
if (zoneIdOrClock instanceof core.ZoneId) {
|
|
60
|
+
return DayOfMonth.nowZoneId(zoneIdOrClock);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (zoneIdOrClock instanceof core.Clock) {
|
|
64
|
+
return DayOfMonth.nowClock(zoneIdOrClock);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
|
|
68
|
+
|
|
69
|
+
default:
|
|
70
|
+
throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
DayOfMonth.now0 = function now0() {
|
|
75
|
+
return this.now(core.Clock.systemDefaultZone());
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
DayOfMonth.nowZoneId = function nowZoneId(zone) {
|
|
79
|
+
return this.now(core.Clock.system(zone));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
DayOfMonth.nowClock = function nowClock(clock) {
|
|
83
|
+
var now = core.LocalDate.now(clock);
|
|
84
|
+
return DayOfMonth.of(now.dayOfMonth());
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
DayOfMonth.of = function of(dayOfMonth) {
|
|
88
|
+
if (1 <= dayOfMonth && dayOfMonth <= 31) {
|
|
89
|
+
return DayOfMonth.VALUES[dayOfMonth - 1];
|
|
90
|
+
} else {
|
|
91
|
+
throw new core.DateTimeException("Invalid value for DayOfMonth: " + dayOfMonth);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
DayOfMonth.from = function from(temporal) {
|
|
96
|
+
if (temporal instanceof DayOfMonth) {
|
|
97
|
+
return temporal;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
requireNonNull(temporal, 'temporal');
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
return DayOfMonth.of(temporal.get(core.ChronoField.DAY_OF_MONTH));
|
|
104
|
+
} catch (ex) {
|
|
105
|
+
throw new core.DateTimeException("Unable to obtain DayOfMonth from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
function DayOfMonth(dayOfMonth) {
|
|
110
|
+
var _this;
|
|
111
|
+
|
|
112
|
+
_this = _TemporalAccessor.call(this) || this;
|
|
113
|
+
_this._day = MathUtil$1.safeToInt(dayOfMonth);
|
|
114
|
+
return _this;
|
|
155
115
|
}
|
|
156
116
|
|
|
157
|
-
|
|
158
|
-
|
|
117
|
+
var _proto = DayOfMonth.prototype;
|
|
118
|
+
|
|
119
|
+
_proto.value = function value() {
|
|
120
|
+
return this._day;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
_proto.isSupported = function isSupported(field) {
|
|
124
|
+
if (field instanceof core.ChronoField) {
|
|
125
|
+
return field === core.ChronoField.DAY_OF_MONTH;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return field != null && field.isSupportedBy(this);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
_proto.range = function range(field) {
|
|
132
|
+
requireNonNull(field, 'field');
|
|
133
|
+
|
|
134
|
+
if (field === core.ChronoField.DAY_OF_MONTH) {
|
|
135
|
+
return field.range();
|
|
136
|
+
}
|
|
159
137
|
|
|
160
|
-
|
|
161
|
-
|
|
138
|
+
return _TemporalAccessor.prototype.range.call(this, field);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
_proto.get = function get(field) {
|
|
142
|
+
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
_proto.getLong = function getLong(field) {
|
|
146
|
+
requireNonNull(field, 'field');
|
|
147
|
+
|
|
148
|
+
if (field === core.ChronoField.DAY_OF_MONTH) {
|
|
149
|
+
return this._day;
|
|
150
|
+
} else if (field instanceof core.ChronoField) {
|
|
151
|
+
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
152
|
+
}
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
return field.getFrom(this);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
_proto.isValidYearMonth = function isValidYearMonth(yearMonth) {
|
|
158
|
+
return yearMonth != null && yearMonth.isValidDay(this._day);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
_proto.query = function query(_query) {
|
|
162
|
+
requireNonNull(_query, 'query');
|
|
163
|
+
requireInstance(_query, core.TemporalQuery, 'query');
|
|
164
|
+
|
|
165
|
+
if (_query === core.TemporalQueries.chronology()) {
|
|
166
|
+
return core.IsoChronology.INSTANCE;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return _TemporalAccessor.prototype.query.call(this, _query);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
_proto.adjustInto = function adjustInto(temporal) {
|
|
173
|
+
requireNonNull(temporal, 'temporal');
|
|
174
|
+
return temporal.with(core.ChronoField.DAY_OF_MONTH, this._day);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
_proto.atMonth = function atMonth(month) {
|
|
178
|
+
requireNonNull(month, 'month');
|
|
179
|
+
|
|
180
|
+
if (month instanceof core.Month) {
|
|
181
|
+
return core.MonthDay.of(month, Math.min(this._day, month.maxLength()));
|
|
182
|
+
} else {
|
|
183
|
+
return core.MonthDay.of(month, Math.min(this._day, core.Month.of(month).maxLength()));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
_proto.atYearMonth = function atYearMonth(yearMonth) {
|
|
188
|
+
requireNonNull(yearMonth, 'yearMonth');
|
|
189
|
+
return yearMonth.atDay(Math.min(this._day, yearMonth.lengthOfMonth()));
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
_proto.compareTo = function compareTo(other) {
|
|
193
|
+
requireNonNull(other, 'other');
|
|
194
|
+
requireInstance(other, DayOfMonth, 'other');
|
|
195
|
+
return this._day - other._day;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
_proto.equals = function equals(obj) {
|
|
199
|
+
if (this === obj) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (obj instanceof DayOfMonth) {
|
|
204
|
+
return this._day === obj._day;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return false;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
_proto.hashCode = function hashCode() {
|
|
211
|
+
return this._day;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
_proto.toString = function toString() {
|
|
215
|
+
return "DayOfMonth:" + this._day;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
return DayOfMonth;
|
|
219
|
+
}(core.TemporalAccessor);
|
|
220
|
+
function _init$2() {
|
|
221
|
+
DayOfMonth.VALUES = new Array(31);
|
|
222
|
+
|
|
223
|
+
for (var i = 0; i < 31; i++) {
|
|
224
|
+
DayOfMonth.VALUES[i] = new DayOfMonth(i + 1);
|
|
165
225
|
}
|
|
226
|
+
}
|
|
166
227
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
228
|
+
var MathUtil = core._.MathUtil;
|
|
229
|
+
var DayOfYear = function (_TemporalAccessor) {
|
|
230
|
+
_inheritsLoose(DayOfYear, _TemporalAccessor);
|
|
170
231
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return
|
|
175
|
-
} else {
|
|
176
|
-
var start = _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["ZonedDateTime"].parse(text.substring(0, i)).toInstant();
|
|
232
|
+
DayOfYear.now = function now(zoneIdOrClock) {
|
|
233
|
+
switch (arguments.length) {
|
|
234
|
+
case 0:
|
|
235
|
+
return DayOfYear.now0();
|
|
177
236
|
|
|
178
|
-
|
|
179
|
-
|
|
237
|
+
case 1:
|
|
238
|
+
requireNonNull(zoneIdOrClock, 'clockOrZone');
|
|
180
239
|
|
|
181
|
-
|
|
182
|
-
|
|
240
|
+
if (zoneIdOrClock instanceof core.ZoneId) {
|
|
241
|
+
return DayOfYear.nowZoneId(zoneIdOrClock);
|
|
242
|
+
}
|
|
183
243
|
|
|
184
|
-
|
|
185
|
-
|
|
244
|
+
if (zoneIdOrClock instanceof core.Clock) {
|
|
245
|
+
return DayOfYear.nowClock(zoneIdOrClock);
|
|
186
246
|
}
|
|
187
247
|
|
|
188
|
-
|
|
248
|
+
throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
|
|
189
249
|
|
|
190
|
-
|
|
191
|
-
|
|
250
|
+
default:
|
|
251
|
+
throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
|
|
192
252
|
}
|
|
193
|
-
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
DayOfYear.now0 = function now0() {
|
|
256
|
+
return DayOfYear.now(core.Clock.systemDefaultZone());
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
DayOfYear.nowZoneId = function nowZoneId(zone) {
|
|
260
|
+
return DayOfYear.now(core.Clock.system(zone));
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
DayOfYear.nowClock = function nowClock(clock) {
|
|
264
|
+
var now = core.LocalDate.now(clock);
|
|
265
|
+
return DayOfYear.of(now.dayOfYear());
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
DayOfYear.of = function of(dayOfYear) {
|
|
269
|
+
if (1 <= dayOfYear && dayOfYear <= 366) {
|
|
270
|
+
return DayOfYear.VALUES[dayOfYear - 1];
|
|
271
|
+
} else {
|
|
272
|
+
throw new core.DateTimeException("Invalid value for DayOfYear: " + dayOfYear);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
194
275
|
|
|
195
|
-
|
|
196
|
-
|
|
276
|
+
DayOfYear.from = function from(temporal) {
|
|
277
|
+
requireNonNull(temporal, 'temporal');
|
|
278
|
+
requireInstance(temporal, core.TemporalAccessor, 'temporal');
|
|
197
279
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
280
|
+
if (temporal instanceof DayOfYear) {
|
|
281
|
+
return temporal;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
return DayOfYear.of(temporal.get(core.ChronoField.DAY_OF_YEAR));
|
|
286
|
+
} catch (ex) {
|
|
287
|
+
throw new core.DateTimeException("Unable to obtain DayOfYear from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
202
290
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_proto.end = function end() {
|
|
210
|
-
return this._end;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
_proto.isEmpty = function isEmpty() {
|
|
214
|
-
return this._start.equals(this._end);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
_proto.isUnboundedStart = function isUnboundedStart() {
|
|
218
|
-
return this._start.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
_proto.isUnboundedEnd = function isUnboundedEnd() {
|
|
222
|
-
return this._end.equals(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
_proto.withStart = function withStart(start) {
|
|
226
|
-
return Interval.of(start, this._end);
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
_proto.withEnd = function withEnd(end) {
|
|
230
|
-
return Interval.of(this._start, end);
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
_proto.contains = function contains(instant) {
|
|
234
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(instant, 'instant');
|
|
235
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(instant, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"], 'instant');
|
|
236
|
-
return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
_proto.encloses = function encloses(other) {
|
|
240
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
|
|
241
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
242
|
-
return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
_proto.abuts = function abuts(other) {
|
|
246
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
|
|
247
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
248
|
-
return !this._end.equals(other.start()) !== !this._start.equals(other.end());
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
_proto.isConnected = function isConnected(other) {
|
|
252
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
|
|
253
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
254
|
-
return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
_proto.overlaps = function overlaps(other) {
|
|
258
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
|
|
259
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
260
|
-
return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
_proto.intersection = function intersection(other) {
|
|
264
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireNonNull"])(other, 'other');
|
|
265
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
266
|
-
|
|
267
|
-
if (this.isConnected(other) === false) {
|
|
268
|
-
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["DateTimeException"]("Intervals do not connect: " + this + " and " + other);
|
|
291
|
+
function DayOfYear(dayOfYear) {
|
|
292
|
+
var _this;
|
|
293
|
+
|
|
294
|
+
_this = _TemporalAccessor.call(this) || this;
|
|
295
|
+
_this._day = MathUtil.safeToInt(dayOfYear);
|
|
296
|
+
return _this;
|
|
269
297
|
}
|
|
270
298
|
|
|
271
|
-
var
|
|
299
|
+
var _proto = DayOfYear.prototype;
|
|
272
300
|
|
|
273
|
-
|
|
301
|
+
_proto.value = function value() {
|
|
302
|
+
return this._day;
|
|
303
|
+
};
|
|
274
304
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else {
|
|
280
|
-
var newStart = cmpStart >= 0 ? this._start : other.start();
|
|
281
|
-
var newEnd = cmpEnd <= 0 ? this._end : other.end();
|
|
282
|
-
return Interval.of(newStart, newEnd);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
305
|
+
_proto.isSupported = function isSupported(field) {
|
|
306
|
+
if (field instanceof core.ChronoField) {
|
|
307
|
+
return field === core.ChronoField.DAY_OF_YEAR;
|
|
308
|
+
}
|
|
285
309
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
310
|
+
return field != null && field.isSupportedBy(this);
|
|
311
|
+
};
|
|
289
312
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
313
|
+
_proto.range = function range(field) {
|
|
314
|
+
requireNonNull(field, 'field');
|
|
293
315
|
|
|
294
|
-
|
|
316
|
+
if (field === core.ChronoField.DAY_OF_YEAR) {
|
|
317
|
+
return field.range();
|
|
318
|
+
}
|
|
295
319
|
|
|
296
|
-
|
|
320
|
+
return _TemporalAccessor.prototype.range.call(this, field);
|
|
321
|
+
};
|
|
297
322
|
|
|
298
|
-
|
|
299
|
-
return
|
|
300
|
-
}
|
|
301
|
-
return this;
|
|
302
|
-
} else {
|
|
303
|
-
var newStart = cmpStart >= 0 ? other.start() : this._start;
|
|
304
|
-
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
|
|
305
|
-
return Interval.of(newStart, newEnd);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
323
|
+
_proto.get = function get(field) {
|
|
324
|
+
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
325
|
+
};
|
|
308
326
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["requireInstance"])(other, Interval, 'other');
|
|
327
|
+
_proto.getLong = function getLong(field) {
|
|
328
|
+
requireNonNull(field, 'field');
|
|
312
329
|
|
|
313
|
-
|
|
330
|
+
if (field === core.ChronoField.DAY_OF_YEAR) {
|
|
331
|
+
return this._day;
|
|
332
|
+
} else if (field instanceof core.ChronoField) {
|
|
333
|
+
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
334
|
+
}
|
|
314
335
|
|
|
315
|
-
|
|
336
|
+
return field.getFrom(this);
|
|
337
|
+
};
|
|
316
338
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
};
|
|
339
|
+
_proto.isValidYear = function isValidYear(year) {
|
|
340
|
+
return this._day < 366 || core.Year.isLeap(year);
|
|
341
|
+
};
|
|
321
342
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
} else {
|
|
326
|
-
return this.isAfterInterval(instantOrInterval);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
343
|
+
_proto.query = function query(_query) {
|
|
344
|
+
requireNonNull(_query, 'query');
|
|
345
|
+
requireInstance(_query, core.TemporalQuery, 'query');
|
|
329
346
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
} else {
|
|
334
|
-
return this.isBeforeInterval(instantOrInterval);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
347
|
+
if (_query === core.TemporalQueries.chronology()) {
|
|
348
|
+
return core.IsoChronology.INSTANCE;
|
|
349
|
+
}
|
|
337
350
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
};
|
|
351
|
+
return _TemporalAccessor.prototype.query.call(this, _query);
|
|
352
|
+
};
|
|
341
353
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
354
|
+
_proto.adjustInto = function adjustInto(temporal) {
|
|
355
|
+
requireNonNull(temporal, 'temporal');
|
|
356
|
+
return temporal.with(core.ChronoField.DAY_OF_YEAR, this._day);
|
|
357
|
+
};
|
|
345
358
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
};
|
|
359
|
+
_proto.atYear = function atYear(year) {
|
|
360
|
+
requireNonNull(year, 'year');
|
|
349
361
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
362
|
+
if (year instanceof core.Year) {
|
|
363
|
+
return year.atDay(this._day);
|
|
364
|
+
} else {
|
|
365
|
+
return core.LocalDate.ofYearDay(year, this._day);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
353
368
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
369
|
+
_proto.compareTo = function compareTo(other) {
|
|
370
|
+
requireNonNull(other, 'other');
|
|
371
|
+
requireInstance(other, DayOfYear, 'other');
|
|
372
|
+
return this._day - other._day;
|
|
373
|
+
};
|
|
357
374
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
375
|
+
_proto.equals = function equals(obj) {
|
|
376
|
+
if (this === obj) {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
362
379
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
380
|
+
if (obj instanceof DayOfYear) {
|
|
381
|
+
return this._day === obj._day;
|
|
382
|
+
}
|
|
366
383
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return Interval;
|
|
379
|
-
}();
|
|
380
|
-
function _init() {
|
|
381
|
-
Interval.ALL = Interval.of(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MIN, _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["Instant"].MAX);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/***/ }),
|
|
385
|
-
|
|
386
|
-
/***/ "./src/_init.js":
|
|
387
|
-
/*!**********************!*\
|
|
388
|
-
!*** ./src/_init.js ***!
|
|
389
|
-
\**********************/
|
|
390
|
-
/*! no exports provided */
|
|
391
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
392
|
-
|
|
393
|
-
"use strict";
|
|
394
|
-
__webpack_require__.r(__webpack_exports__);
|
|
395
|
-
/* harmony import */ var _Interval__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Interval */ "./src/Interval.js");
|
|
396
|
-
/*
|
|
397
|
-
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
398
|
-
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
399
|
-
*/
|
|
400
|
-
|
|
401
|
-
var isInit = false;
|
|
402
|
-
|
|
403
|
-
function init() {
|
|
404
|
-
if (isInit) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
384
|
+
return false;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
_proto.hashCode = function hashCode() {
|
|
388
|
+
return this._day;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
_proto.toString = function toString() {
|
|
392
|
+
return "DayOfYear:" + this._day;
|
|
393
|
+
};
|
|
407
394
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
/***/ "./src/assert.js":
|
|
417
|
-
/*!***********************!*\
|
|
418
|
-
!*** ./src/assert.js ***!
|
|
419
|
-
\***********************/
|
|
420
|
-
/*! exports provided: assert, requireNonNull, requireInstance, abstractMethodFail */
|
|
421
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
422
|
-
|
|
423
|
-
"use strict";
|
|
424
|
-
__webpack_require__.r(__webpack_exports__);
|
|
425
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return assert; });
|
|
426
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requireNonNull", function() { return requireNonNull; });
|
|
427
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requireInstance", function() { return requireInstance; });
|
|
428
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "abstractMethodFail", function() { return abstractMethodFail; });
|
|
429
|
-
/* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js-joda/core */ "@js-joda/core");
|
|
430
|
-
/* harmony import */ var _js_joda_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_js_joda_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
431
|
-
/**
|
|
432
|
-
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
433
|
-
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
|
-
function assert(assertion, msg, error) {
|
|
437
|
-
if (!assertion) {
|
|
438
|
-
if (error) {
|
|
439
|
-
throw new error(msg);
|
|
440
|
-
} else {
|
|
441
|
-
throw new Error(msg);
|
|
395
|
+
return DayOfYear;
|
|
396
|
+
}(core.TemporalAccessor);
|
|
397
|
+
function _init$1() {
|
|
398
|
+
DayOfYear.VALUES = new Array(366);
|
|
399
|
+
|
|
400
|
+
for (var i = 0; i < 366; i++) {
|
|
401
|
+
DayOfYear.VALUES[i] = new DayOfYear(i + 1);
|
|
442
402
|
}
|
|
443
403
|
}
|
|
444
|
-
}
|
|
445
|
-
function requireNonNull(value, parameterName) {
|
|
446
|
-
if (value == null) {
|
|
447
|
-
throw new _js_joda_core__WEBPACK_IMPORTED_MODULE_0__["NullPointerException"](parameterName + " must not be null");
|
|
448
|
-
}
|
|
449
404
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
405
|
+
/*
|
|
406
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
407
|
+
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
408
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
409
|
+
*/
|
|
410
|
+
var Interval = function () {
|
|
411
|
+
Interval.of = function of(startInstant, endInstantOrDuration) {
|
|
412
|
+
if (endInstantOrDuration instanceof core.Duration) {
|
|
413
|
+
return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
|
|
414
|
+
} else {
|
|
415
|
+
return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
456
418
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
419
|
+
Interval.ofInstantInstant = function ofInstantInstant(startInclusive, endExclusive) {
|
|
420
|
+
requireNonNull(startInclusive, 'startInclusive');
|
|
421
|
+
requireNonNull(endExclusive, 'endExclusive');
|
|
422
|
+
requireInstance(startInclusive, core.Instant, 'startInclusive');
|
|
423
|
+
requireInstance(endExclusive, core.Instant, 'endExclusive');
|
|
462
424
|
|
|
463
|
-
|
|
425
|
+
if (endExclusive.isBefore(startInclusive)) {
|
|
426
|
+
throw new core.DateTimeException('End instant must on or after start instant');
|
|
427
|
+
}
|
|
464
428
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
!*** ./src/js-joda-extra.js ***!
|
|
468
|
-
\******************************/
|
|
469
|
-
/*! exports provided: Interval */
|
|
470
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
429
|
+
return new Interval(startInclusive, endExclusive);
|
|
430
|
+
};
|
|
471
431
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Interval", function() { return _Interval__WEBPACK_IMPORTED_MODULE_1__["Interval"]; });
|
|
432
|
+
Interval.ofInstantDuration = function ofInstantDuration(startInclusive, duration) {
|
|
433
|
+
requireNonNull(startInclusive, 'startInclusive');
|
|
434
|
+
requireNonNull(duration, 'duration');
|
|
435
|
+
requireInstance(startInclusive, core.Instant, 'startInclusive');
|
|
436
|
+
requireInstance(duration, core.Duration, 'duration');
|
|
478
437
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
483
|
-
*/
|
|
438
|
+
if (duration.isNegative()) {
|
|
439
|
+
throw new core.DateTimeException('Duration must not be zero or negative');
|
|
440
|
+
}
|
|
484
441
|
|
|
442
|
+
return new Interval(startInclusive, startInclusive.plus(duration));
|
|
443
|
+
};
|
|
485
444
|
|
|
445
|
+
Interval.parse = function parse(text) {
|
|
446
|
+
requireNonNull(text, 'text');
|
|
486
447
|
|
|
487
|
-
|
|
448
|
+
if (!(typeof text === 'string')) {
|
|
449
|
+
throw new core.IllegalArgumentException("text must be a string, but is " + text.constructor.name);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
for (var i = 0; i < text.length; i += 1) {
|
|
453
|
+
if (text.charAt(i) === '/') {
|
|
454
|
+
var firstChar = text.charAt(0);
|
|
455
|
+
|
|
456
|
+
if (firstChar === 'P' || firstChar === 'p') {
|
|
457
|
+
var duration = core.Duration.parse(text.substring(0, i));
|
|
458
|
+
var end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
|
|
459
|
+
return Interval.of(end.minus(duration), end);
|
|
460
|
+
} else {
|
|
461
|
+
var start = core.ZonedDateTime.parse(text.substring(0, i)).toInstant();
|
|
462
|
+
|
|
463
|
+
if (i + 1 < text.length) {
|
|
464
|
+
var c = text.charAt(i + 1);
|
|
465
|
+
|
|
466
|
+
if (c === 'P' || c === 'p') {
|
|
467
|
+
var _duration = core.Duration.parse(text.substring(i + 1, text.length));
|
|
468
|
+
|
|
469
|
+
return Interval.of(start, start.plus(_duration));
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
var _end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
|
|
474
|
+
|
|
475
|
+
return Interval.of(start, _end);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
488
479
|
|
|
480
|
+
throw new core.DateTimeParseException('Interval cannot be parsed, no forward slash found', text, 0);
|
|
481
|
+
};
|
|
489
482
|
|
|
490
|
-
|
|
483
|
+
function Interval(startInclusive, endExclusive) {
|
|
484
|
+
this._start = startInclusive;
|
|
485
|
+
this._end = endExclusive;
|
|
486
|
+
}
|
|
491
487
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
488
|
+
var _proto = Interval.prototype;
|
|
489
|
+
|
|
490
|
+
_proto.start = function start() {
|
|
491
|
+
return this._start;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
_proto.end = function end() {
|
|
495
|
+
return this._end;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
_proto.isEmpty = function isEmpty() {
|
|
499
|
+
return this._start.equals(this._end);
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
_proto.isUnboundedStart = function isUnboundedStart() {
|
|
503
|
+
return this._start.equals(core.Instant.MIN);
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
_proto.isUnboundedEnd = function isUnboundedEnd() {
|
|
507
|
+
return this._end.equals(core.Instant.MAX);
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
_proto.withStart = function withStart(start) {
|
|
511
|
+
return Interval.of(start, this._end);
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
_proto.withEnd = function withEnd(end) {
|
|
515
|
+
return Interval.of(this._start, end);
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
_proto.contains = function contains(instant) {
|
|
519
|
+
requireNonNull(instant, 'instant');
|
|
520
|
+
requireInstance(instant, core.Instant, 'instant');
|
|
521
|
+
return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
_proto.encloses = function encloses(other) {
|
|
525
|
+
requireNonNull(other, 'other');
|
|
526
|
+
requireInstance(other, Interval, 'other');
|
|
527
|
+
return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
_proto.abuts = function abuts(other) {
|
|
531
|
+
requireNonNull(other, 'other');
|
|
532
|
+
requireInstance(other, Interval, 'other');
|
|
533
|
+
return !this._end.equals(other.start()) !== !this._start.equals(other.end());
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
_proto.isConnected = function isConnected(other) {
|
|
537
|
+
requireNonNull(other, 'other');
|
|
538
|
+
requireInstance(other, Interval, 'other');
|
|
539
|
+
return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
_proto.overlaps = function overlaps(other) {
|
|
543
|
+
requireNonNull(other, 'other');
|
|
544
|
+
requireInstance(other, Interval, 'other');
|
|
545
|
+
return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
_proto.intersection = function intersection(other) {
|
|
549
|
+
requireNonNull(other, 'other');
|
|
550
|
+
requireInstance(other, Interval, 'other');
|
|
551
|
+
|
|
552
|
+
if (this.isConnected(other) === false) {
|
|
553
|
+
throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
var cmpStart = this._start.compareTo(other.start());
|
|
557
|
+
|
|
558
|
+
var cmpEnd = this._end.compareTo(other.end());
|
|
559
|
+
|
|
560
|
+
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
561
|
+
return this;
|
|
562
|
+
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
563
|
+
return other;
|
|
564
|
+
} else {
|
|
565
|
+
var newStart = cmpStart >= 0 ? this._start : other.start();
|
|
566
|
+
var newEnd = cmpEnd <= 0 ? this._end : other.end();
|
|
567
|
+
return Interval.of(newStart, newEnd);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
498
570
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
571
|
+
_proto.union = function union(other) {
|
|
572
|
+
requireNonNull(other, 'other');
|
|
573
|
+
requireInstance(other, Interval, 'other');
|
|
574
|
+
|
|
575
|
+
if (this.isConnected(other) === false) {
|
|
576
|
+
throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
var cmpStart = this._start.compareTo(other.start());
|
|
580
|
+
|
|
581
|
+
var cmpEnd = this._end.compareTo(other.end());
|
|
582
|
+
|
|
583
|
+
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
584
|
+
return other;
|
|
585
|
+
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
586
|
+
return this;
|
|
587
|
+
} else {
|
|
588
|
+
var newStart = cmpStart >= 0 ? other.start() : this._start;
|
|
589
|
+
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
|
|
590
|
+
return Interval.of(newStart, newEnd);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
_proto.span = function span(other) {
|
|
595
|
+
requireNonNull(other, 'other');
|
|
596
|
+
requireInstance(other, Interval, 'other');
|
|
597
|
+
|
|
598
|
+
var cmpStart = this._start.compareTo(other.start());
|
|
599
|
+
|
|
600
|
+
var cmpEnd = this._end.compareTo(other.end());
|
|
601
|
+
|
|
602
|
+
var newStart = cmpStart >= 0 ? other.start() : this._start;
|
|
603
|
+
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
|
|
604
|
+
return Interval.of(newStart, newEnd);
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
_proto.isAfter = function isAfter(instantOrInterval) {
|
|
608
|
+
if (instantOrInterval instanceof core.Instant) {
|
|
609
|
+
return this.isAfterInstant(instantOrInterval);
|
|
610
|
+
} else {
|
|
611
|
+
return this.isAfterInterval(instantOrInterval);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
_proto.isBefore = function isBefore(instantOrInterval) {
|
|
616
|
+
if (instantOrInterval instanceof core.Instant) {
|
|
617
|
+
return this.isBeforeInstant(instantOrInterval);
|
|
618
|
+
} else {
|
|
619
|
+
return this.isBeforeInterval(instantOrInterval);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
_proto.isAfterInstant = function isAfterInstant(instant) {
|
|
624
|
+
return this._start.compareTo(instant) > 0;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
_proto.isBeforeInstant = function isBeforeInstant(instant) {
|
|
628
|
+
return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
_proto.isAfterInterval = function isAfterInterval(interval) {
|
|
632
|
+
return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
_proto.isBeforeInterval = function isBeforeInterval(interval) {
|
|
636
|
+
return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
_proto.toDuration = function toDuration() {
|
|
640
|
+
return core.Duration.between(this._start, this._end);
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
_proto.equals = function equals(obj) {
|
|
644
|
+
if (this === obj) {
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (obj instanceof Interval) {
|
|
649
|
+
return this._start.equals(obj.start()) && this._end.equals(obj.end());
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return false;
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
_proto.hashCode = function hashCode() {
|
|
656
|
+
return this._start.hashCode() ^ this._end.hashCode();
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
_proto.toString = function toString() {
|
|
660
|
+
return this._start.toString() + "/" + this._end.toString();
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
return Interval;
|
|
664
|
+
}();
|
|
665
|
+
function _init() {
|
|
666
|
+
Interval.ALL = Interval.of(core.Instant.MIN, core.Instant.MAX);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/*
|
|
670
|
+
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
|
|
671
|
+
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
672
|
+
*/
|
|
673
|
+
var isInit = false;
|
|
674
|
+
|
|
675
|
+
function init() {
|
|
676
|
+
if (isInit) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
isInit = true;
|
|
681
|
+
_init$2();
|
|
682
|
+
_init$1();
|
|
683
|
+
_init();
|
|
684
|
+
}
|
|
506
685
|
|
|
507
|
-
|
|
686
|
+
init();
|
|
508
687
|
|
|
509
|
-
|
|
688
|
+
/*
|
|
689
|
+
* @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
|
|
690
|
+
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
691
|
+
*/
|
|
692
|
+
function plug () {}
|
|
510
693
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/***/ (function(module, exports) {
|
|
694
|
+
/*
|
|
695
|
+
* @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
|
|
696
|
+
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
697
|
+
*/
|
|
698
|
+
core.use(plug);
|
|
517
699
|
|
|
518
|
-
|
|
700
|
+
exports.DayOfMonth = DayOfMonth;
|
|
701
|
+
exports.DayOfYear = DayOfYear;
|
|
702
|
+
exports.Interval = Interval;
|
|
519
703
|
|
|
520
|
-
|
|
704
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
521
705
|
|
|
522
|
-
|
|
523
|
-
|
|
706
|
+
}));
|
|
707
|
+
//# sourceMappingURL=js-joda-extra.js.map
|