node_modules: update
This commit is contained in:
parent
4a21c51f2f
commit
b91baffed3
107 changed files with 3886 additions and 2943 deletions
27
node_modules/luxon/src/interval.js
generated
vendored
27
node_modules/luxon/src/interval.js
generated
vendored
|
|
@ -31,7 +31,7 @@ function validateStartEnd(start, end) {
|
|||
* * **Accessors** Use {@link start} and {@link end} to get the start and end.
|
||||
* * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.
|
||||
* * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.
|
||||
* * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}
|
||||
* * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}.
|
||||
* * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}.
|
||||
*/
|
||||
export default class Interval {
|
||||
|
|
@ -134,19 +134,32 @@ export default class Interval {
|
|||
static fromISO(text, opts) {
|
||||
const [s, e] = (text || "").split("/", 2);
|
||||
if (s && e) {
|
||||
const start = DateTime.fromISO(s, opts),
|
||||
end = DateTime.fromISO(e, opts);
|
||||
let start, startIsValid;
|
||||
try {
|
||||
start = DateTime.fromISO(s, opts);
|
||||
startIsValid = start.isValid;
|
||||
} catch (e) {
|
||||
startIsValid = false;
|
||||
}
|
||||
|
||||
if (start.isValid && end.isValid) {
|
||||
let end, endIsValid;
|
||||
try {
|
||||
end = DateTime.fromISO(e, opts);
|
||||
endIsValid = end.isValid;
|
||||
} catch (e) {
|
||||
endIsValid = false;
|
||||
}
|
||||
|
||||
if (startIsValid && endIsValid) {
|
||||
return Interval.fromDateTimes(start, end);
|
||||
}
|
||||
|
||||
if (start.isValid) {
|
||||
if (startIsValid) {
|
||||
const dur = Duration.fromISO(e, opts);
|
||||
if (dur.isValid) {
|
||||
return Interval.after(start, dur);
|
||||
}
|
||||
} else if (end.isValid) {
|
||||
} else if (endIsValid) {
|
||||
const dur = Duration.fromISO(s, opts);
|
||||
if (dur.isValid) {
|
||||
return Interval.before(end, dur);
|
||||
|
|
@ -234,7 +247,7 @@ export default class Interval {
|
|||
* @return {boolean}
|
||||
*/
|
||||
hasSame(unit) {
|
||||
return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;
|
||||
return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue