@adyen/adyen-platform-experience-web
Version:

45 lines (44 loc) • 1.14 kB
JavaScript
import { RANGE_FROM as s, RANGE_TO as h } from "../constants.js";
import { computeTimestampOffset as e, getEdgesDistance as m } from "../utils.js";
class r {
#h = 1 / 0;
#t = 1 / 0;
#i = -1 / 0;
#e = 0;
#s = 0;
constructor(...t) {
if (t.length >= 3) {
const i = new Date(t[1]).getTime();
if (typeof t[2] != "symbol")
this.#i = i || this.#i, this.#t = new Date(t[2]).getTime() || this.#t, this.#t < this.#i && ([this.#t, this.#i] = [this.#i, this.#t]), this.#s = e(this.#i, t[0]), this.#e = e(this.#t, t[0]), this.#h = m(this.#i, this.#t, t[0]) + 1;
else if (!isNaN(i))
switch (t[2]) {
case h:
this.#t = i, this.#e = e(this.#t, t[0]);
break;
case s:
default:
this.#i = i, this.#s = e(this.#i, t[0]);
break;
}
}
}
get numberOfMonths() {
return this.#h;
}
get endTimestamp() {
return this.#t;
}
get endTimestampOffset() {
return this.#e;
}
get startTimestamp() {
return this.#i;
}
get startTimestampOffset() {
return this.#s;
}
}
export {
r as default
};