Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-time

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-time - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

rollup.config.mjs

539

build/vega-time.js

@@ -22,4 +22,5 @@ (function (global, factory) {

const u = vegaUtil.array(units).slice(),
m = {}; // check validity
m = {};
// check validity
if (!u.length) vegaUtil.error('Missing time unit.');

@@ -34,8 +35,7 @@ u.forEach(unit => {

const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);
if (numTypes > 1) {
vegaUtil.error(`Incompatible time units: ${units}`);
} // ensure proper sort order
}
// ensure proper sort order
u.sort((a, b) => UNITS[a] - UNITS[b]);

@@ -62,13 +62,11 @@ return u;

const s = vegaUtil.extend({}, defaultSpecifiers, specifiers),
u = timeUnits(units),
n = u.length;
u = timeUnits(units),
n = u.length;
let fmt = '',
start = 0,
end,
key;
start = 0,
end,
key;
for (start = 0; start < n;) {
for (end = u.length; end > start; --end) {
key = u.slice(start, end).join('-');
if (s[key] != null) {

@@ -81,54 +79,43 @@ fmt += s[key];

}
return fmt.trim();
}
var t0$1 = new Date(),
t1 = new Date();
function newInterval(floori, offseti, count, field) {
const t0$1 = new Date(),
t1 = new Date();
function timeInterval$1(floori, offseti, count, field) {
function interval(date) {
return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date;
}
interval.floor = function (date) {
interval.floor = date => {
return floori(date = new Date(+date)), date;
};
interval.ceil = function (date) {
interval.ceil = date => {
return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
};
interval.round = function (date) {
var d0 = interval(date),
d1 = interval.ceil(date);
interval.round = date => {
const d0 = interval(date),
d1 = interval.ceil(date);
return date - d0 < d1 - date ? d0 : d1;
};
interval.offset = function (date, step) {
interval.offset = (date, step) => {
return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
};
interval.range = function (start, stop, step) {
var range = [],
previous;
interval.range = (start, stop, step) => {
const range = [];
start = interval.ceil(start);
step = step == null ? 1 : Math.floor(step);
if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
let previous;
do range.push(previous = new Date(+start)), offseti(start, step), floori(start); while (previous < start && start < stop);
return range;
};
interval.filter = function (test) {
return newInterval(function (date) {
interval.filter = test => {
return timeInterval$1(date => {
if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
}, function (date, step) {
}, (date, step) => {
if (date >= date) {
if (step < 0) while (++step <= 0) {
while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
} else while (--step >= 0) {
while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
}

@@ -140,3 +127,3 @@ }

if (count) {
interval.count = function (start, end) {
interval.count = (start, end) => {
t0$1.setTime(+start), t1.setTime(+end);

@@ -146,38 +133,33 @@ floori(t0$1), floori(t1);

};
interval.every = function (step) {
interval.every = step => {
step = Math.floor(step);
return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function (d) {
return field(d) % step === 0;
} : function (d) {
return interval.count(0, d) % step === 0;
});
return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? d => field(d) % step === 0 : d => interval.count(0, d) % step === 0);
};
}
return interval;
}
var millisecond = newInterval(function () {// noop
}, function (date, step) {
const millisecond = timeInterval$1(() => {
// noop
}, (date, step) => {
date.setTime(+date + step);
}, function (start, end) {
}, (start, end) => {
return end - start;
}); // An optimized implementation for this simple case.
});
millisecond.every = function (k) {
// An optimized implementation for this simple case.
millisecond.every = k => {
k = Math.floor(k);
if (!isFinite(k) || !(k > 0)) return null;
if (!(k > 1)) return millisecond;
return newInterval(function (date) {
return timeInterval$1(date => {
date.setTime(Math.floor(date / k) * k);
}, function (date, step) {
}, (date, step) => {
date.setTime(+date + step * k);
}, function (start, end) {
}, (start, end) => {
return (end - start) / k;
});
};
millisecond.range;
var utcMillisecond = millisecond;
const durationSecond$1 = 1000;

@@ -189,179 +171,195 @@ const durationMinute$1 = durationSecond$1 * 60;

var second = newInterval(function (date) {
const second = timeInterval$1(date => {
date.setTime(date - date.getMilliseconds());
}, function (date, step) {
}, (date, step) => {
date.setTime(+date + step * durationSecond$1);
}, function (start, end) {
}, (start, end) => {
return (end - start) / durationSecond$1;
}, function (date) {
}, date => {
return date.getUTCSeconds();
});
var utcSecond = second;
second.range;
var minute = newInterval(function (date) {
const timeMinute = timeInterval$1(date => {
date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1);
}, function (date, step) {
}, (date, step) => {
date.setTime(+date + step * durationMinute$1);
}, function (start, end) {
}, (start, end) => {
return (end - start) / durationMinute$1;
}, function (date) {
}, date => {
return date.getMinutes();
});
var timeMinute = minute;
timeMinute.range;
const utcMinute = timeInterval$1(date => {
date.setUTCSeconds(0, 0);
}, (date, step) => {
date.setTime(+date + step * durationMinute$1);
}, (start, end) => {
return (end - start) / durationMinute$1;
}, date => {
return date.getUTCMinutes();
});
utcMinute.range;
var hour = newInterval(function (date) {
const timeHour = timeInterval$1(date => {
date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1 - date.getMinutes() * durationMinute$1);
}, function (date, step) {
}, (date, step) => {
date.setTime(+date + step * durationHour$1);
}, function (start, end) {
}, (start, end) => {
return (end - start) / durationHour$1;
}, function (date) {
}, date => {
return date.getHours();
});
var timeHour = hour;
timeHour.range;
const utcHour = timeInterval$1(date => {
date.setUTCMinutes(0, 0, 0);
}, (date, step) => {
date.setTime(+date + step * durationHour$1);
}, (start, end) => {
return (end - start) / durationHour$1;
}, date => {
return date.getUTCHours();
});
utcHour.range;
var day = newInterval(date => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, date => date.getDate() - 1);
var timeDay = day;
const timeDay = timeInterval$1(date => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, date => date.getDate() - 1);
timeDay.range;
const utcDay = timeInterval$1(date => {
date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
date.setUTCDate(date.getUTCDate() + step);
}, (start, end) => {
return (end - start) / durationDay$1;
}, date => {
return date.getUTCDate() - 1;
});
utcDay.range;
const unixDay = timeInterval$1(date => {
date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
date.setUTCDate(date.getUTCDate() + step);
}, (start, end) => {
return (end - start) / durationDay$1;
}, date => {
return Math.floor(date / durationDay$1);
});
unixDay.range;
function weekday$1(i) {
return newInterval(function (date) {
function timeWeekday(i) {
return timeInterval$1(date => {
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setDate(date.getDate() + step * 7);
}, function (start, end) {
}, (start, end) => {
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
});
}
const timeSunday = timeWeekday(0);
const timeMonday = timeWeekday(1);
const timeTuesday = timeWeekday(2);
const timeWednesday = timeWeekday(3);
const timeThursday = timeWeekday(4);
const timeFriday = timeWeekday(5);
const timeSaturday = timeWeekday(6);
timeSunday.range;
timeMonday.range;
timeTuesday.range;
timeWednesday.range;
timeThursday.range;
timeFriday.range;
timeSaturday.range;
function utcWeekday(i) {
return timeInterval$1(date => {
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
date.setUTCDate(date.getUTCDate() + step * 7);
}, (start, end) => {
return (end - start) / durationWeek$1;
});
}
const utcSunday = utcWeekday(0);
const utcMonday = utcWeekday(1);
const utcTuesday = utcWeekday(2);
const utcWednesday = utcWeekday(3);
const utcThursday = utcWeekday(4);
const utcFriday = utcWeekday(5);
const utcSaturday = utcWeekday(6);
utcSunday.range;
utcMonday.range;
utcTuesday.range;
utcWednesday.range;
utcThursday.range;
utcFriday.range;
utcSaturday.range;
var sunday = weekday$1(0);
weekday$1(1);
weekday$1(2);
weekday$1(3);
weekday$1(4);
weekday$1(5);
weekday$1(6);
var month = newInterval(function (date) {
const timeMonth = timeInterval$1(date => {
date.setDate(1);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setMonth(date.getMonth() + step);
}, function (start, end) {
}, (start, end) => {
return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, function (date) {
}, date => {
return date.getMonth();
});
var timeMonth = month;
timeMonth.range;
const utcMonth = timeInterval$1(date => {
date.setUTCDate(1);
date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
date.setUTCMonth(date.getUTCMonth() + step);
}, (start, end) => {
return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, date => {
return date.getUTCMonth();
});
utcMonth.range;
var year = newInterval(function (date) {
const timeYear = timeInterval$1(date => {
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setFullYear(date.getFullYear() + step);
}, function (start, end) {
}, (start, end) => {
return end.getFullYear() - start.getFullYear();
}, function (date) {
}, date => {
return date.getFullYear();
}); // An optimized implementation for this simple case.
});
year.every = function (k) {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) {
// An optimized implementation for this simple case.
timeYear.every = k => {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1(date => {
date.setFullYear(Math.floor(date.getFullYear() / k) * k);
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setFullYear(date.getFullYear() + step * k);
});
};
var timeYear = year;
var utcMinute = newInterval(function (date) {
date.setUTCSeconds(0, 0);
}, function (date, step) {
date.setTime(+date + step * durationMinute$1);
}, function (start, end) {
return (end - start) / durationMinute$1;
}, function (date) {
return date.getUTCMinutes();
});
var utcMinute$1 = utcMinute;
var utcHour = newInterval(function (date) {
date.setUTCMinutes(0, 0, 0);
}, function (date, step) {
date.setTime(+date + step * durationHour$1);
}, function (start, end) {
return (end - start) / durationHour$1;
}, function (date) {
return date.getUTCHours();
});
var utcHour$1 = utcHour;
var utcDay = newInterval(function (date) {
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
return (end - start) / durationDay$1;
}, function (date) {
return date.getUTCDate() - 1;
});
var utcDay$1 = utcDay;
function utcWeekday(i) {
return newInterval(function (date) {
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
date.setUTCDate(date.getUTCDate() + step * 7);
}, function (start, end) {
return (end - start) / durationWeek$1;
});
}
var utcSunday = utcWeekday(0);
utcWeekday(1);
utcWeekday(2);
utcWeekday(3);
utcWeekday(4);
utcWeekday(5);
utcWeekday(6);
var utcMonth = newInterval(function (date) {
date.setUTCDate(1);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
date.setUTCMonth(date.getUTCMonth() + step);
}, function (start, end) {
return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, function (date) {
return date.getUTCMonth();
});
var utcMonth$1 = utcMonth;
var utcYear = newInterval(function (date) {
timeYear.range;
const utcYear = timeInterval$1(date => {
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setUTCFullYear(date.getUTCFullYear() + step);
}, function (start, end) {
}, (start, end) => {
return end.getUTCFullYear() - start.getUTCFullYear();
}, function (date) {
}, date => {
return date.getUTCFullYear();
}); // An optimized implementation for this simple case.
});
utcYear.every = function (k) {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) {
// An optimized implementation for this simple case.
utcYear.every = k => {
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1(date => {
date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
}, (date, step) => {
date.setUTCFullYear(date.getUTCFullYear() + step * k);
});
};
utcYear.range;
var utcYear$1 = utcYear;
function ascending(a, b) {

@@ -371,19 +369,26 @@ return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;

function descending(a, b) {
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
function bisector(f) {
let delta = f;
let compare1 = f;
let compare2 = f;
let compare1, compare2, delta;
// If an accessor is specified, promote it to a comparator. In this case we
// can test whether the search value is (self-) comparable. We can’t do this
// for a comparator (except for specific, known comparators) because we can’t
// tell if the comparator is symmetric, and an asymmetric comparator can’t be
// used to test whether a single value is comparable.
if (f.length !== 2) {
delta = (d, x) => f(d) - x;
compare1 = ascending;
compare2 = (d, x) => ascending(f(d), x);
delta = (d, x) => f(d) - x;
} else {
compare1 = f === ascending || f === descending ? f : zero;
compare2 = f;
delta = f;
}
function left(a, x, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x, x) !== 0) return hi;
do {

@@ -394,10 +399,7 @@ const mid = lo + hi >>> 1;

}
return lo;
}
function right(a, x, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x, x) !== 0) return hi;
do {

@@ -408,6 +410,4 @@ const mid = lo + hi >>> 1;

}
return lo;
}
function center(a, x, lo = 0, hi = a.length) {

@@ -417,3 +417,2 @@ const i = left(a, x, lo, hi - 1);

}
return {

@@ -425,16 +424,44 @@ left,

}
function zero() {
return 0;
}
var e10 = Math.sqrt(50),
e5 = Math.sqrt(10),
e2 = Math.sqrt(2);
const e10 = Math.sqrt(50),
e5 = Math.sqrt(10),
e2 = Math.sqrt(2);
function tickSpec(start, stop, count) {
const step = (stop - start) / Math.max(0, count),
power = Math.floor(Math.log10(step)),
error = step / Math.pow(10, power),
factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
let i1, i2, inc;
if (power < 0) {
inc = Math.pow(10, -power) / factor;
i1 = Math.round(start * inc);
i2 = Math.round(stop * inc);
if (i1 / inc < start) ++i1;
if (i2 / inc > stop) --i2;
inc = -inc;
} else {
inc = Math.pow(10, power) * factor;
i1 = Math.round(start / inc);
i2 = Math.round(stop / inc);
if (i1 * inc < start) ++i1;
if (i2 * inc > stop) --i2;
}
if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
return [i1, i2, inc];
}
function tickIncrement(start, stop, count) {
stop = +stop, start = +start, count = +count;
return tickSpec(start, stop, count)[2];
}
function tickStep(start, stop, count) {
var step0 = Math.abs(stop - start) / Math.max(0, count),
step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
error = step0 / step1;
if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2;
return stop < start ? -step1 : step1;
stop = +stop, start = +start, count = +count;
const reverse = stop < start,
inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
}
const t0 = new Date();
function localYear(y) {

@@ -447,3 +474,2 @@ t0.setFullYear(y);

}
function dayofyear(d) {

@@ -459,3 +485,3 @@ return localDayOfYear(new Date(d));

function localWeekNum(d) {
return sunday.count(localYear(d.getFullYear()) - 1, d);
return timeSunday.count(localYear(d.getFullYear()) - 1, d);
}

@@ -471,3 +497,2 @@ function localFirst(y) {

}
return new Date(y, m, d, H, M, S, L);

@@ -483,3 +508,3 @@ }

const y = Date.UTC(d.getUTCFullYear(), 0, 1);
return utcDay$1.count(y - 1, d);
return utcDay.count(y - 1, d);
}

@@ -500,3 +525,2 @@ function utcWeekNum(d) {

}
return new Date(Date.UTC(y, m, d, H, M, S, L));

@@ -507,17 +531,16 @@ }

const s = step || 1,
b = vegaUtil.peek(units),
_ = (unit, p, key) => {
key = key || unit;
return getUnit(get[key], inv[key], unit === b && s, p);
};
b = vegaUtil.peek(units),
_ = (unit, p, key) => {
key = key || unit;
return getUnit(get[key], inv[key], unit === b && s, p);
};
const t = new Date(),
u = vegaUtil.toSet(units),
y = u[YEAR] ? _(YEAR) : vegaUtil.constant(2012),
m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : vegaUtil.zero,
d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : vegaUtil.one,
H = u[HOURS] ? _(HOURS) : vegaUtil.zero,
M = u[MINUTES] ? _(MINUTES) : vegaUtil.zero,
S = u[SECONDS] ? _(SECONDS) : vegaUtil.zero,
L = u[MILLISECONDS] ? _(MILLISECONDS) : vegaUtil.zero;
u = vegaUtil.toSet(units),
y = u[YEAR] ? _(YEAR) : vegaUtil.constant(2012),
m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : vegaUtil.zero,
d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : vegaUtil.one,
H = u[HOURS] ? _(HOURS) : vegaUtil.zero,
M = u[MINUTES] ? _(MINUTES) : vegaUtil.zero,
S = u[SECONDS] ? _(SECONDS) : vegaUtil.zero,
L = u[MILLISECONDS] ? _(MILLISECONDS) : vegaUtil.zero;
return function (v) {

@@ -529,14 +552,14 @@ t.setTime(+v);

}
function getUnit(f, inv, step, phase) {
const u = step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);
return inv ? (d, y) => inv(u(d, y), y) : u;
} // returns the day of the year based on week number, day of week,
}
// returns the day of the year based on week number, day of week,
// and the day of the week for the first day of the year
function weekday(week, day, firstDay) {
return day + week * 7 - (firstDay + 6) % 7;
} // -- LOCAL TIME --
}
// -- LOCAL TIME --

@@ -563,4 +586,6 @@ const localGet = {

return floor(units, step || 1, localGet, localInv, localDate);
} // -- UTC TIME --
}
// -- UTC TIME --
const utcGet = {

@@ -592,3 +617,3 @@ [YEAR]: d => d.getUTCFullYear(),

[MONTH]: timeMonth,
[WEEK]: sunday,
[WEEK]: timeSunday,
[DATE]: timeDay,

@@ -599,17 +624,17 @@ [DAY]: timeDay,

[MINUTES]: timeMinute,
[SECONDS]: utcSecond,
[MILLISECONDS]: utcMillisecond
[SECONDS]: second,
[MILLISECONDS]: millisecond
};
const utcIntervals = {
[YEAR]: utcYear$1,
[QUARTER]: utcMonth$1.every(3),
[MONTH]: utcMonth$1,
[YEAR]: utcYear,
[QUARTER]: utcMonth.every(3),
[MONTH]: utcMonth,
[WEEK]: utcSunday,
[DATE]: utcDay$1,
[DAY]: utcDay$1,
[DAYOFYEAR]: utcDay$1,
[HOURS]: utcHour$1,
[MINUTES]: utcMinute$1,
[SECONDS]: utcSecond,
[MILLISECONDS]: utcMillisecond
[DATE]: utcDay,
[DAY]: utcDay,
[DAYOFYEAR]: utcDay,
[HOURS]: utcHour,
[MINUTES]: utcMinute,
[SECONDS]: second,
[MILLISECONDS]: millisecond
};

@@ -622,7 +647,5 @@ function timeInterval(unit) {

}
function offset(ival, date, step) {
return ival ? ival.offset(date, step) : undefined;
}
function timeOffset(unit, date, step) {

@@ -634,7 +657,5 @@ return offset(timeInterval(unit), date, step);

}
function sequence(ival, start, stop, step) {
return ival ? ival.range(start, stop, step) : undefined;
}
function timeSequence(unit, start, stop, step) {

@@ -648,25 +669,24 @@ return sequence(timeInterval(unit), start, stop, step);

const durationSecond = 1000,
durationMinute = durationSecond * 60,
durationHour = durationMinute * 60,
durationDay = durationHour * 24,
durationWeek = durationDay * 7,
durationMonth = durationDay * 30,
durationYear = durationDay * 365;
durationMinute = durationSecond * 60,
durationHour = durationMinute * 60,
durationDay = durationHour * 24,
durationWeek = durationDay * 7,
durationMonth = durationDay * 30,
durationYear = durationDay * 365;
const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],
Seconds = Milli.slice(0, -1),
Minutes = Seconds.slice(0, -1),
Hours = Minutes.slice(0, -1),
Day = Hours.slice(0, -1),
Week = [YEAR, WEEK],
Month = [YEAR, MONTH],
Year = [YEAR];
Seconds = Milli.slice(0, -1),
Minutes = Seconds.slice(0, -1),
Hours = Minutes.slice(0, -1),
Day = Hours.slice(0, -1),
Week = [YEAR, WEEK],
Month = [YEAR, MONTH],
Year = [YEAR];
const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
function bin (opt) {
const ext = opt.extent,
max = opt.maxbins || 40,
target = Math.abs(vegaUtil.span(ext)) / max;
max = opt.maxbins || 40,
target = Math.abs(vegaUtil.span(ext)) / max;
let i = bisector(i => i[2]).right(intervals, target),
units,
step;
units,
step;
if (i === intervals.length) {

@@ -682,3 +702,2 @@ units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max);

}
return {

@@ -718,4 +737,2 @@ units,

Object.defineProperty(exports, '__esModule', { value: true });
}));

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega)}(this,(function(t,e){"use strict";const n="year",r="quarter",o="month",u="week",i="date",c="day",f="dayofyear",a="hours",s="minutes",l="seconds",g="milliseconds",T=[n,r,o,u,i,c,f,a,s,l,g],h=T.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function M(t){const n=e.array(t).slice(),r={};n.length||e.error("Missing time unit."),n.forEach((t=>{e.hasOwnProperty(h,t)?r[t]=1:e.error("Invalid time unit: ".concat(t,"."))}));return(r.week||r.day?1:0)+(r.quarter||r.month||r.date?1:0)+(r.dayofyear?1:0)>1&&e.error("Incompatible time units: ".concat(t)),n.sort(((t,e)=>h[t]-h[e])),n}const U={[n]:"%Y ",[r]:"Q%q ",[o]:"%b ",[i]:"%d ",[u]:"W%U ",[c]:"%a ",[f]:"%j ",[a]:"%H:00",[s]:"00:%M",[l]:":%S",[g]:".%L",["".concat(n,"-").concat(o)]:"%Y-%m ",["".concat(n,"-").concat(o,"-").concat(i)]:"%Y-%m-%d ",["".concat(a,"-").concat(s)]:"%H:%M"};var C=new Date,d=new Date;function D(t,e,n,r){function o(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return o.floor=function(e){return t(e=new Date(+e)),e},o.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},o.round=function(t){var e=o(t),n=o.ceil(t);return t-e<n-t?e:n},o.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},o.range=function(n,r,u){var i,c=[];if(n=o.ceil(n),u=null==u?1:Math.floor(u),!(n<r&&u>0))return c;do{c.push(i=new Date(+n)),e(n,u),t(n)}while(i<n&&n<r);return c},o.filter=function(n){return D((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(o.count=function(e,r){return C.setTime(+e),d.setTime(+r),t(C),t(d),Math.floor(n(C,d))},o.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(r?function(e){return r(e)%t==0}:function(e){return o.count(0,e)%t==0}):o:null}),o}var m=D((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));m.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?D((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):m:null};var y=m;const F=1e3,Y=6e4,v=36e5,w=864e5,H=6048e5;var S=D((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*F)}),(function(t,e){return(e-t)/F}),(function(t){return t.getUTCSeconds()})),p=D((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getMinutes()})),O=D((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F-t.getMinutes()*Y)}),(function(t,e){t.setTime(+t+e*v)}),(function(t,e){return(e-t)/v}),(function(t){return t.getHours()})),E=D((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/w),(t=>t.getDate()-1));function b(t){return D((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/H}))}var q=b(0);b(1),b(2),b(3),b(4),b(5),b(6);var N=D((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),z=D((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));z.every=function(t){return isFinite(t=Math.floor(t))&&t>0?D((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var I=z,k=D((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getUTCMinutes()})),x=D((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*v)}),(function(t,e){return(e-t)/v}),(function(t){return t.getUTCHours()})),A=D((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/w}),(function(t){return t.getUTCDate()-1}));function R(t){return D((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/H}))}var j=R(0);R(1),R(2),R(3),R(4),R(5),R(6);var L=D((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),_=D((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));_.every=function(t){return isFinite(t=Math.floor(t))&&t>0?D((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var P=_;function Q(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}var W=Math.sqrt(50),B=Math.sqrt(10),K=Math.sqrt(2);function G(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),o=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),u=r/o;return u>=W?o*=10:u>=B?o*=5:u>=K&&(o*=2),e<t?-o:o}const J=new Date;function V(t){return J.setFullYear(t),J.setMonth(0),J.setDate(1),J.setHours(0,0,0,0),J}function X(t){return E.count(V(t.getFullYear())-1,t)}function Z(t){return q.count(V(t.getFullYear())-1,t)}function $(t){return V(t).getDay()}function tt(t,e,n,r,o,u,i){if(0<=t&&t<100){const c=new Date(-1,e,n,r,o,u,i);return c.setFullYear(t),c}return new Date(t,e,n,r,o,u,i)}function et(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return A.count(e-1,t)}function nt(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return j.count(e-1,t)}function rt(t){return J.setTime(Date.UTC(t,0,1)),J.getUTCDay()}function ot(t,e,n,r,o,u,i){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,o,u,i));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,o,u,i))}function ut(t,T,h,M,U){const C=T||1,d=e.peek(t),D=(t,e,n)=>function(t,e,n,r){const o=n<=1?t:r?(e,o)=>r+n*Math.floor((t(e,o)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(o(t,n),n):o}(h[n=n||t],M[n],t===d&&C,e),m=new Date,y=e.toSet(t),F=y.year?D(n):e.constant(2012),Y=y.month?D(o):y.quarter?D(r):e.zero,v=y.week&&y.day?D(c,1,u+c):y.week?D(u,1):y.day?D(c,1):y.date?D(i,1):y.dayofyear?D(f,1):e.one,w=y.hours?D(a):e.zero,H=y.minutes?D(s):e.zero,S=y.seconds?D(l):e.zero,p=y.milliseconds?D(g):e.zero;return function(t){m.setTime(+t);const e=F(m);return U(e,Y(m),v(m,e),w(m),H(m),S(m),p(m))}}function it(t,e,n){return e+7*t-(n+6)%7}const ct={[n]:t=>t.getFullYear(),[r]:t=>Math.floor(t.getMonth()/3),[o]:t=>t.getMonth(),[i]:t=>t.getDate(),[a]:t=>t.getHours(),[s]:t=>t.getMinutes(),[l]:t=>t.getSeconds(),[g]:t=>t.getMilliseconds(),[f]:t=>X(t),[u]:t=>Z(t),[u+c]:(t,e)=>it(Z(t),t.getDay(),$(e)),[c]:(t,e)=>it(1,t.getDay(),$(e))},ft={[r]:t=>3*t,[u]:(t,e)=>it(t,0,$(e))};const at={[n]:t=>t.getUTCFullYear(),[r]:t=>Math.floor(t.getUTCMonth()/3),[o]:t=>t.getUTCMonth(),[i]:t=>t.getUTCDate(),[a]:t=>t.getUTCHours(),[s]:t=>t.getUTCMinutes(),[l]:t=>t.getUTCSeconds(),[g]:t=>t.getUTCMilliseconds(),[f]:t=>et(t),[u]:t=>nt(t),[c]:(t,e)=>it(1,t.getUTCDay(),rt(e)),[u+c]:(t,e)=>it(nt(t),t.getUTCDay(),rt(e))},st={[r]:t=>3*t,[u]:(t,e)=>it(t,0,rt(e))};const lt={[n]:I,[r]:N.every(3),[o]:N,[u]:q,[i]:E,[c]:E,[f]:E,[a]:O,[s]:p,[l]:S,[g]:y},gt={[n]:P,[r]:L.every(3),[o]:L,[u]:j,[i]:A,[c]:A,[f]:A,[a]:x,[s]:k,[l]:S,[g]:y};function Tt(t){return lt[t]}function ht(t){return gt[t]}function Mt(t,e,n){return t?t.offset(e,n):void 0}function Ut(t,e,n,r){return t?t.range(e,n,r):void 0}const Ct=1e3,dt=6e4,Dt=36e5,mt=864e5,yt=2592e6,Ft=31536e6,Yt=[n,o,i,a,s,l,g],vt=Yt.slice(0,-1),wt=vt.slice(0,-1),Ht=wt.slice(0,-1),St=Ht.slice(0,-1),pt=[n,o],Ot=[n],Et=[[vt,1,Ct],[vt,5,5e3],[vt,15,15e3],[vt,30,3e4],[wt,1,dt],[wt,5,3e5],[wt,15,9e5],[wt,30,18e5],[Ht,1,Dt],[Ht,3,108e5],[Ht,6,216e5],[Ht,12,432e5],[St,1,mt],[[n,u],1,6048e5],[pt,1,yt],[pt,3,7776e6],[Ot,1,Ft]];t.DATE=i,t.DAY=c,t.DAYOFYEAR=f,t.HOURS=a,t.MILLISECONDS=g,t.MINUTES=s,t.MONTH=o,t.QUARTER=r,t.SECONDS=l,t.TIME_UNITS=T,t.WEEK=u,t.YEAR=n,t.dayofyear=function(t){return X(new Date(t))},t.timeBin=function(t){const n=t.extent,r=t.maxbins||40,o=Math.abs(e.span(n))/r;let u,i,c=function(t){let e=t,n=t,r=t;function o(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(o<u){if(0!==n(e,e))return u;do{const n=o+u>>>1;r(t[n],e)<0?o=n+1:u=n}while(o<u)}return o}return 2!==t.length&&(e=(e,n)=>t(e)-n,n=Q,r=(e,n)=>Q(t(e),n)),{left:o,center:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const u=o(t,n,r,(arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length)-1);return u>r&&e(t[u-1],n)>-e(t[u],n)?u-1:u},right:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(o<u){if(0!==n(e,e))return u;do{const n=o+u>>>1;r(t[n],e)<=0?o=n+1:u=n}while(o<u)}return o}}}((t=>t[2])).right(Et,o);return c===Et.length?(u=Ot,i=G(n[0]/Ft,n[1]/Ft,r)):c?(c=Et[o/Et[c-1][2]<Et[c][2]/o?c-1:c],u=c[0],i=c[1]):(u=Yt,i=Math.max(G(n[0],n[1],r),1)),{units:u,step:i}},t.timeFloor=function(t,e){return ut(t,e||1,ct,ft,tt)},t.timeInterval=Tt,t.timeOffset=function(t,e,n){return Mt(Tt(t),e,n)},t.timeSequence=function(t,e,n,r){return Ut(Tt(t),e,n,r)},t.timeUnitSpecifier=function(t,n){const r=e.extend({},U,n),o=M(t),u=o.length;let i,c,f="",a=0;for(a=0;a<u;)for(i=o.length;i>a;--i)if(c=o.slice(a,i).join("-"),null!=r[c]){f+=r[c],a=i;break}return f.trim()},t.timeUnits=M,t.utcFloor=function(t,e){return ut(t,e||1,at,st,ot)},t.utcInterval=ht,t.utcOffset=function(t,e,n){return Mt(ht(t),e,n)},t.utcSequence=function(t,e,n,r){return Ut(ht(t),e,n,r)},t.utcdayofyear=function(t){return et(new Date(t))},t.utcweek=function(t){return nt(new Date(t))},t.week=function(t){return Z(new Date(t))},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-util"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega)}(this,(function(e,t){"use strict";const n="year",r="quarter",o="month",u="week",s="date",a="day",i="dayofyear",l="hours",c="minutes",g="seconds",f="milliseconds",T=[n,r,o,u,s,a,i,l,c,g,f],h=T.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function M(e){const n=t.array(e).slice(),l={};n.length||t.error("Missing time unit."),n.forEach((e=>{t.hasOwnProperty(h,e)?l[e]=1:t.error(`Invalid time unit: ${e}.`)}));return(l[u]||l[a]?1:0)+(l[r]||l[o]||l[s]?1:0)+(l[i]?1:0)>1&&t.error(`Incompatible time units: ${e}`),n.sort(((e,t)=>h[e]-h[t])),n}const U={[n]:"%Y ",[r]:"Q%q ",[o]:"%b ",[s]:"%d ",[u]:"W%U ",[a]:"%a ",[i]:"%j ",[l]:"%H:00",[c]:"00:%M",[g]:":%S",[f]:".%L",[`${n}-${o}`]:"%Y-%m ",[`${n}-${o}-${s}`]:"%Y-%m-%d ",[`${l}-${c}`]:"%H:%M"};const C=new Date,D=new Date;function d(e,t,n,r){function o(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return o.floor=t=>(e(t=new Date(+t)),t),o.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),o.round=e=>{const t=o(e),n=o.ceil(e);return e-t<n-e?t:n},o.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),o.range=(n,r,u)=>{const s=[];if(n=o.ceil(n),u=null==u?1:Math.floor(u),!(n<r&&u>0))return s;let a;do{s.push(a=new Date(+n)),t(n,u),e(n)}while(a<n&&n<r);return s},o.filter=n=>d((t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),((e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););})),n&&(o.count=(t,r)=>(C.setTime(+t),D.setTime(+r),e(C),e(D),Math.floor(n(C,D))),o.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?o.filter(r?t=>r(t)%e==0:t=>o.count(0,t)%e==0):o:null)),o}const m=d((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e));m.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?d((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):m:null),m.range;const F=1e3,Y=6e4,y=60*Y,w=24*y,v=7*w,H=d((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*F)}),((e,t)=>(t-e)/F),(e=>e.getUTCSeconds()));H.range;const S=d((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*F)}),((e,t)=>{e.setTime(+e+t*Y)}),((e,t)=>(t-e)/Y),(e=>e.getMinutes()));S.range;const p=d((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Y)}),((e,t)=>(t-e)/Y),(e=>e.getUTCMinutes()));p.range;const N=d((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*F-e.getMinutes()*Y)}),((e,t)=>{e.setTime(+e+t*y)}),((e,t)=>(t-e)/y),(e=>e.getHours()));N.range;const O=d((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*y)}),((e,t)=>(t-e)/y),(e=>e.getUTCHours()));O.range;const E=d((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Y)/w),(e=>e.getDate()-1));E.range;const z=d((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/w),(e=>e.getUTCDate()-1));z.range;function I(e){return d((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((e,t)=>{e.setDate(e.getDate()+7*t)}),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Y)/v))}d((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/w),(e=>Math.floor(e/w))).range;const $=I(0),b=I(1),q=I(2),x=I(3),A=I(4),k=I(5),R=I(6);function j(e){return d((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)}),((e,t)=>(t-e)/v))}$.range,b.range,q.range,x.range,A.range,k.range,R.range;const L=j(0),Q=j(1),W=j(2),B=j(3),K=j(4),P=j(5),_=j(6);L.range,Q.range,W.range,B.range,K.range,P.range,_.range;const G=d((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth()));G.range;const J=d((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()));J.range;const V=d((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear()));V.every=e=>isFinite(e=Math.floor(e))&&e>0?d((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,V.range;const X=d((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));function Z(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ee(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function te(){return 0}X.every=e=>isFinite(e=Math.floor(e))&&e>0?d((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,X.range;const ne=Math.sqrt(50),re=Math.sqrt(10),oe=Math.sqrt(2);function ue(e,t,n){const r=(t-e)/Math.max(0,n),o=Math.floor(Math.log10(r)),u=r/Math.pow(10,o),s=u>=ne?10:u>=re?5:u>=oe?2:1;let a,i,l;return o<0?(l=Math.pow(10,-o)/s,a=Math.round(e*l),i=Math.round(t*l),a/l<e&&++a,i/l>t&&--i,l=-l):(l=Math.pow(10,o)*s,a=Math.round(e/l),i=Math.round(t/l),a*l<e&&++a,i*l>t&&--i),i<a&&.5<=n&&n<2?ue(e,t,2*n):[a,i,l]}function se(e,t,n){return ue(e=+e,t=+t,n=+n)[2]}function ae(e,t,n){n=+n;const r=(t=+t)<(e=+e),o=r?se(t,e,n):se(e,t,n);return(r?-1:1)*(o<0?1/-o:o)}const ie=new Date;function le(e){return ie.setFullYear(e),ie.setMonth(0),ie.setDate(1),ie.setHours(0,0,0,0),ie}function ce(e){return E.count(le(e.getFullYear())-1,e)}function ge(e){return $.count(le(e.getFullYear())-1,e)}function fe(e){return le(e).getDay()}function Te(e,t,n,r,o,u,s){if(0<=e&&e<100){const a=new Date(-1,t,n,r,o,u,s);return a.setFullYear(e),a}return new Date(e,t,n,r,o,u,s)}function he(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return z.count(t-1,e)}function Me(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return L.count(t-1,e)}function Ue(e){return ie.setTime(Date.UTC(e,0,1)),ie.getUTCDay()}function Ce(e,t,n,r,o,u,s){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,r,o,u,s));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,o,u,s))}function De(e,T,h,M,U){const C=T||1,D=t.peek(e),d=(e,t,n)=>function(e,t,n,r){const o=n<=1?e:r?(t,o)=>r+n*Math.floor((e(t,o)-r)/n):(t,r)=>n*Math.floor(e(t,r)/n);return t?(e,n)=>t(o(e,n),n):o}(h[n=n||e],M[n],e===D&&C,t),m=new Date,F=t.toSet(e),Y=F[n]?d(n):t.constant(2012),y=F[o]?d(o):F[r]?d(r):t.zero,w=F[u]&&F[a]?d(a,1,u+a):F[u]?d(u,1):F[a]?d(a,1):F[s]?d(s,1):F[i]?d(i,1):t.one,v=F[l]?d(l):t.zero,H=F[c]?d(c):t.zero,S=F[g]?d(g):t.zero,p=F[f]?d(f):t.zero;return function(e){m.setTime(+e);const t=Y(m);return U(t,y(m),w(m,t),v(m),H(m),S(m),p(m))}}function de(e,t,n){return t+7*e-(n+6)%7}const me={[n]:e=>e.getFullYear(),[r]:e=>Math.floor(e.getMonth()/3),[o]:e=>e.getMonth(),[s]:e=>e.getDate(),[l]:e=>e.getHours(),[c]:e=>e.getMinutes(),[g]:e=>e.getSeconds(),[f]:e=>e.getMilliseconds(),[i]:e=>ce(e),[u]:e=>ge(e),[u+a]:(e,t)=>de(ge(e),e.getDay(),fe(t)),[a]:(e,t)=>de(1,e.getDay(),fe(t))},Fe={[r]:e=>3*e,[u]:(e,t)=>de(e,0,fe(t))};const Ye={[n]:e=>e.getUTCFullYear(),[r]:e=>Math.floor(e.getUTCMonth()/3),[o]:e=>e.getUTCMonth(),[s]:e=>e.getUTCDate(),[l]:e=>e.getUTCHours(),[c]:e=>e.getUTCMinutes(),[g]:e=>e.getUTCSeconds(),[f]:e=>e.getUTCMilliseconds(),[i]:e=>he(e),[u]:e=>Me(e),[a]:(e,t)=>de(1,e.getUTCDay(),Ue(t)),[u+a]:(e,t)=>de(Me(e),e.getUTCDay(),Ue(t))},ye={[r]:e=>3*e,[u]:(e,t)=>de(e,0,Ue(t))};const we={[n]:V,[r]:G.every(3),[o]:G,[u]:$,[s]:E,[a]:E,[i]:E,[l]:N,[c]:S,[g]:H,[f]:m},ve={[n]:X,[r]:J.every(3),[o]:J,[u]:L,[s]:z,[a]:z,[i]:z,[l]:O,[c]:p,[g]:H,[f]:m};function He(e){return we[e]}function Se(e){return ve[e]}function pe(e,t,n){return e?e.offset(t,n):void 0}function Ne(e,t,n,r){return e?e.range(t,n,r):void 0}const Oe=1e3,Ee=6e4,ze=36e5,Ie=864e5,$e=2592e6,be=31536e6,qe=[n,o,s,l,c,g,f],xe=qe.slice(0,-1),Ae=xe.slice(0,-1),ke=Ae.slice(0,-1),Re=ke.slice(0,-1),je=[n,o],Le=[n],Qe=[[xe,1,Oe],[xe,5,5e3],[xe,15,15e3],[xe,30,3e4],[Ae,1,Ee],[Ae,5,3e5],[Ae,15,9e5],[Ae,30,18e5],[ke,1,ze],[ke,3,108e5],[ke,6,216e5],[ke,12,432e5],[Re,1,Ie],[[n,u],1,6048e5],[je,1,$e],[je,3,7776e6],[Le,1,be]];e.DATE=s,e.DAY=a,e.DAYOFYEAR=i,e.HOURS=l,e.MILLISECONDS=f,e.MINUTES=c,e.MONTH=o,e.QUARTER=r,e.SECONDS=g,e.TIME_UNITS=T,e.WEEK=u,e.YEAR=n,e.dayofyear=function(e){return ce(new Date(e))},e.timeBin=function(e){const n=e.extent,r=e.maxbins||40,o=Math.abs(t.span(n))/r;let u,s,a=function(e){let t,n,r;function o(e,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length;if(o<u){if(0!==t(r,r))return u;do{const t=o+u>>>1;n(e[t],r)<0?o=t+1:u=t}while(o<u)}return o}return 2!==e.length?(t=Z,n=(t,n)=>Z(e(t),n),r=(t,n)=>e(t)-n):(t=e===Z||e===ee?e:te,n=e,r=e),{left:o,center:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const u=o(e,t,n,(arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length)-1);return u>n&&r(e[u-1],t)>-r(e[u],t)?u-1:u},right:function(e,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length;if(o<u){if(0!==t(r,r))return u;do{const t=o+u>>>1;n(e[t],r)<=0?o=t+1:u=t}while(o<u)}return o}}}((e=>e[2])).right(Qe,o);return a===Qe.length?(u=Le,s=ae(n[0]/be,n[1]/be,r)):a?(a=Qe[o/Qe[a-1][2]<Qe[a][2]/o?a-1:a],u=a[0],s=a[1]):(u=qe,s=Math.max(ae(n[0],n[1],r),1)),{units:u,step:s}},e.timeFloor=function(e,t){return De(e,t||1,me,Fe,Te)},e.timeInterval=He,e.timeOffset=function(e,t,n){return pe(He(e),t,n)},e.timeSequence=function(e,t,n,r){return Ne(He(e),t,n,r)},e.timeUnitSpecifier=function(e,n){const r=t.extend({},U,n),o=M(e),u=o.length;let s,a,i="",l=0;for(l=0;l<u;)for(s=o.length;s>l;--s)if(a=o.slice(l,s).join("-"),null!=r[a]){i+=r[a],l=s;break}return i.trim()},e.timeUnits=M,e.utcFloor=function(e,t){return De(e,t||1,Ye,ye,Ce)},e.utcInterval=Se,e.utcOffset=function(e,t,n){return pe(Se(e),t,n)},e.utcSequence=function(e,t,n,r){return Ne(Se(e),t,n,r)},e.utcdayofyear=function(e){return he(new Date(e))},e.utcweek=function(e){return Me(new Date(e))},e.week=function(e){return ge(new Date(e))}}));
//# sourceMappingURL=vega-time.min.js.map

@@ -20,4 +20,5 @@ import { array, error, hasOwnProperty, extend, peek, toSet, constant, zero, one, span } from 'vega-util';

const u = array(units).slice(),
m = {}; // check validity
m = {};
// check validity
if (!u.length) error('Missing time unit.');

@@ -28,12 +29,11 @@ u.forEach(unit => {

} else {
error("Invalid time unit: ".concat(unit, "."));
error(`Invalid time unit: ${unit}.`);
}
});
const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);
if (numTypes > 1) {
error("Incompatible time units: ".concat(units));
} // ensure proper sort order
error(`Incompatible time units: ${units}`);
}
// ensure proper sort order
u.sort((a, b) => UNITS[a] - UNITS[b]);

@@ -54,19 +54,17 @@ return u;

[MILLISECONDS]: '.%L',
["".concat(YEAR, "-").concat(MONTH)]: '%Y-%m ',
["".concat(YEAR, "-").concat(MONTH, "-").concat(DATE)]: '%Y-%m-%d ',
["".concat(HOURS, "-").concat(MINUTES)]: '%H:%M'
[`${YEAR}-${MONTH}`]: '%Y-%m ',
[`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ',
[`${HOURS}-${MINUTES}`]: '%H:%M'
};
function timeUnitSpecifier(units, specifiers) {
const s = extend({}, defaultSpecifiers, specifiers),
u = timeUnits(units),
n = u.length;
u = timeUnits(units),
n = u.length;
let fmt = '',
start = 0,
end,
key;
start = 0,
end,
key;
for (start = 0; start < n;) {
for (end = u.length; end > start; --end) {
key = u.slice(start, end).join('-');
if (s[key] != null) {

@@ -79,3 +77,2 @@ fmt += s[key];

}
return fmt.trim();

@@ -85,3 +82,2 @@ }

const t0 = new Date();
function localYear(y) {

@@ -94,3 +90,2 @@ t0.setFullYear(y);

}
function dayofyear(d) {

@@ -117,3 +112,2 @@ return localDayOfYear(new Date(d));

}
return new Date(y, m, d, H, M, S, L);

@@ -145,3 +139,2 @@ }

}
return new Date(Date.UTC(y, m, d, H, M, S, L));

@@ -152,17 +145,16 @@ }

const s = step || 1,
b = peek(units),
_ = (unit, p, key) => {
key = key || unit;
return getUnit(get[key], inv[key], unit === b && s, p);
};
b = peek(units),
_ = (unit, p, key) => {
key = key || unit;
return getUnit(get[key], inv[key], unit === b && s, p);
};
const t = new Date(),
u = toSet(units),
y = u[YEAR] ? _(YEAR) : constant(2012),
m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero,
d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one,
H = u[HOURS] ? _(HOURS) : zero,
M = u[MINUTES] ? _(MINUTES) : zero,
S = u[SECONDS] ? _(SECONDS) : zero,
L = u[MILLISECONDS] ? _(MILLISECONDS) : zero;
u = toSet(units),
y = u[YEAR] ? _(YEAR) : constant(2012),
m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero,
d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one,
H = u[HOURS] ? _(HOURS) : zero,
M = u[MINUTES] ? _(MINUTES) : zero,
S = u[SECONDS] ? _(SECONDS) : zero,
L = u[MILLISECONDS] ? _(MILLISECONDS) : zero;
return function (v) {

@@ -174,14 +166,14 @@ t.setTime(+v);

}
function getUnit(f, inv, step, phase) {
const u = step <= 1 ? f : phase ? (d, y) => phase + step * Math.floor((f(d, y) - phase) / step) : (d, y) => step * Math.floor(f(d, y) / step);
return inv ? (d, y) => inv(u(d, y), y) : u;
} // returns the day of the year based on week number, day of week,
}
// returns the day of the year based on week number, day of week,
// and the day of the week for the first day of the year
function weekday(week, day, firstDay) {
return day + week * 7 - (firstDay + 6) % 7;
} // -- LOCAL TIME --
}
// -- LOCAL TIME --

@@ -208,4 +200,6 @@ const localGet = {

return floor(units, step || 1, localGet, localInv, localDate);
} // -- UTC TIME --
}
// -- UTC TIME --
const utcGet = {

@@ -265,7 +259,5 @@ [YEAR]: d => d.getUTCFullYear(),

}
function offset(ival, date, step) {
return ival ? ival.offset(date, step) : undefined;
}
function timeOffset(unit, date, step) {

@@ -277,7 +269,5 @@ return offset(timeInterval(unit), date, step);

}
function sequence(ival, start, stop, step) {
return ival ? ival.range(start, stop, step) : undefined;
}
function timeSequence(unit, start, stop, step) {

@@ -291,25 +281,24 @@ return sequence(timeInterval(unit), start, stop, step);

const durationSecond = 1000,
durationMinute = durationSecond * 60,
durationHour = durationMinute * 60,
durationDay = durationHour * 24,
durationWeek = durationDay * 7,
durationMonth = durationDay * 30,
durationYear = durationDay * 365;
durationMinute = durationSecond * 60,
durationHour = durationMinute * 60,
durationDay = durationHour * 24,
durationWeek = durationDay * 7,
durationMonth = durationDay * 30,
durationYear = durationDay * 365;
const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],
Seconds = Milli.slice(0, -1),
Minutes = Seconds.slice(0, -1),
Hours = Minutes.slice(0, -1),
Day = Hours.slice(0, -1),
Week = [YEAR, WEEK],
Month = [YEAR, MONTH],
Year = [YEAR];
Seconds = Milli.slice(0, -1),
Minutes = Seconds.slice(0, -1),
Hours = Minutes.slice(0, -1),
Day = Hours.slice(0, -1),
Week = [YEAR, WEEK],
Month = [YEAR, MONTH],
Year = [YEAR];
const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
function bin (opt) {
const ext = opt.extent,
max = opt.maxbins || 40,
target = Math.abs(span(ext)) / max;
max = opt.maxbins || 40,
target = Math.abs(span(ext)) / max;
let i = bisector(i => i[2]).right(intervals, target),
units,
step;
units,
step;
if (i === intervals.length) {

@@ -325,3 +314,2 @@ units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max);

}
return {

@@ -328,0 +316,0 @@ units,

{
"name": "vega-time",
"version": "2.1.0",
"version": "2.1.1",
"description": "JavaScript date/time utilities for Vega.",

@@ -19,3 +19,3 @@ "keywords": [

"prebuild": "rimraf build",
"build": "rollup -c",
"build": "rollup -c rollup.config.mjs",
"pretest": "yarn build --config-test",

@@ -26,7 +26,7 @@ "test": "tape 'test/**/*-test.js'",

"dependencies": {
"d3-array": "^3.1.1",
"d3-time": "^3.0.0",
"vega-util": "^1.15.2"
"d3-array": "^3.2.2",
"d3-time": "^3.1.0",
"vega-util": "^1.17.1"
},
"gitHead": "9a3faca4395cade9ecdfde90af98f1c53e9916b2"
"gitHead": "fb1092f6b931d450f9c210b67ae4752bd3dd461b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc