Socket
Socket
Sign inDemoInstall

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.0.1 to 2.0.2

6

build/vega-time.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-time'), require('d3-array')) :
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-time', 'd3-array'], factory) :
(global = global || self, factory(global.vega = {}, global.vega, global.d3, global.d3));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.d3, global.d3));
}(this, (function (exports, vegaUtil, d3Time, d3Array) { 'use strict';

@@ -136,3 +136,3 @@

if (0 <= y && y < 100) {
var date = new Date(-1, m, d, H, M, S, L);
const date = new Date(-1, m, d, H, M, S, L);
date.setFullYear(y);

@@ -169,3 +169,3 @@ return date;

if (0 <= y && y < 100) {
var date = new Date(Date.UTC(-1, m, d, H, M, S, L));
const date = new Date(Date.UTC(-1, m, d, H, M, S, L));
date.setUTCFullYear(d.y);

@@ -172,0 +172,0 @@ return date;

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-time"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-time","d3-array"],t):t((e=e||self).vega={},e.vega,e.d3,e.d3)}(this,(function(e,t,n,r){"use strict";const o="year",i="quarter",u="month",a="week",c="date",s="day",l="hours",f="minutes",d="seconds",y=[o,i,u,a,c,s,"dayofyear",l,f,d,"milliseconds"],m=y.reduce((e,t,n)=>(e[t]=1+n,e),{});function g(e){const n=t.array(e).slice(),r={};n.length||t.error("Missing time unit."),n.forEach(e=>{t.hasOwnProperty(m,e)?r[e]=1:t.error(`Invalid time unit: ${e}.`)});return(r[a]||r.day?1:0)+(r[i]||r[u]||r[c]?1:0)+(r.dayofyear?1:0)>1&&t.error("Incompatible time units: "+e),n.sort((e,t)=>m[e]-m[t]),n}const D={[o]:"%Y ",[i]:"Q%q ",[u]:"%b ",[c]:"%d ",[a]:"W%U ",[s]:"%a ",dayofyear:"%j ",[l]:"%H:00",[f]:"00:%M",[d]:":%S",milliseconds:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ",["hours-"+f]:"%H:%M"};const M=new Date;function h(e){return M.setFullYear(e),M.setMonth(0),M.setDate(1),M.setHours(0,0,0,0),M}function T(e){return n.timeDay.count(h(e.getFullYear())-1,e)}function U(e){return n.timeWeek.count(h(e.getFullYear())-1,e)}function C(e){return h(e).getDay()}function S(e,t,n,r,o,i,u){if(0<=e&&e<100){var a=new Date(-1,t,n,r,o,i,u);return a.setFullYear(e),a}return new Date(e,t,n,r,o,i,u)}function Y(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcDay.count(t-1,e)}function p(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcWeek.count(t-1,e)}function v(e){return M.setTime(Date.UTC(e,0,1)),M.getUTCDay()}function w(e,t,n,r,o,i,u){if(0<=e&&e<100){var a=new Date(Date.UTC(-1,t,n,r,o,i,u));return a.setUTCFullYear(n.y),a}return new Date(Date.UTC(e,t,n,r,o,i,u))}function F(e,n,r,y,m){const g=n||1,D=t.peek(e),M=(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}(r[n=n||e],y[n],e===D&&g,t),h=new Date,T=t.toSet(e),U=T[o]?M(o):t.constant(2012),C=T[u]?M(u):T[i]?M(i):t.zero,S=T[a]&&T.day?M(s,1,a+s):T[a]?M(a,1):T.day?M(s,1):T[c]?M(c,1):T.dayofyear?M("dayofyear",1):t.one,Y=T[l]?M(l):t.zero,p=T[f]?M(f):t.zero,v=T[d]?M(d):t.zero,w=T.milliseconds?M("milliseconds"):t.zero;return function(e){h.setTime(+e);const t=U(h);return m(t,C(h),S(h,t),Y(h),p(h),v(h),w(h))}}function k(e,t,n){return t+7*e-(n+6)%7}const E={[o]:e=>e.getFullYear(),[i]:e=>Math.floor(e.getMonth()/3),[u]:e=>e.getMonth(),[c]:e=>e.getDate(),[l]:e=>e.getHours(),[f]:e=>e.getMinutes(),[d]:e=>e.getSeconds(),milliseconds:e=>e.getMilliseconds(),dayofyear:e=>T(e),[a]:e=>U(e),[a+s]:(e,t)=>k(U(e),e.getDay(),C(t)),[s]:(e,t)=>k(1,e.getDay(),C(t))},H={[i]:e=>3*e,[a]:(e,t)=>k(e,0,C(t))};const I={[o]:e=>e.getUTCFullYear(),[i]:e=>Math.floor(e.getUTCMonth()/3),[u]:e=>e.getUTCMonth(),[c]:e=>e.getUTCDate(),[l]:e=>e.getUTCHours(),[f]:e=>e.getUTCMinutes(),[d]:e=>e.getUTCSeconds(),milliseconds:e=>e.getUTCMilliseconds(),dayofyear:e=>Y(e),[a]:e=>p(e),[s]:(e,t)=>k(1,e.getUTCDay(),v(t)),[a+s]:(e,t)=>k(p(e),e.getUTCDay(),v(t))},O={[i]:e=>3*e,[a]:(e,t)=>k(e,0,v(t))};const b={[o]:n.timeYear,[i]:n.timeMonth.every(3),[u]:n.timeMonth,[a]:n.timeWeek,[c]:n.timeDay,[s]:n.timeDay,dayofyear:n.timeDay,[l]:n.timeHour,[f]:n.timeMinute,[d]:n.timeSecond,milliseconds:n.timeMillisecond},q={[o]:n.utcYear,[i]:n.utcMonth.every(3),[u]:n.utcMonth,[a]:n.utcWeek,[c]:n.utcDay,[s]:n.utcDay,dayofyear:n.utcDay,[l]:n.utcHour,[f]:n.utcMinute,[d]:n.utcSecond,milliseconds:n.utcMillisecond};function x(e){return b[e]}function A(e){return q[e]}function W(e,t,n){return e?e.offset(t,n):void 0}function z(e,t,n,r){return e?e.range(t,n,r):void 0}const N=[o,u,c,l,f,d,"milliseconds"],R=N.slice(0,-1),j=R.slice(0,-1),L=j.slice(0,-1),_=L.slice(0,-1),P=[o,u],Q=[o],B=[[R,1,1e3],[R,5,5e3],[R,15,15e3],[R,30,3e4],[j,1,6e4],[j,5,3e5],[j,15,9e5],[j,30,18e5],[L,1,36e5],[L,3,108e5],[L,6,216e5],[L,12,432e5],[_,1,864e5],[[o,a],1,6048e5],[P,1,2592e6],[P,3,7776e6],[Q,1,31536e6]];e.DATE=c,e.DAY=s,e.DAYOFYEAR="dayofyear",e.HOURS=l,e.MILLISECONDS="milliseconds",e.MINUTES=f,e.MONTH=u,e.QUARTER=i,e.SECONDS=d,e.TIME_UNITS=y,e.WEEK=a,e.YEAR=o,e.dayofyear=function(e){return T(new Date(e))},e.timeBin=function(e){const n=e.extent,o=e.maxbins||40,i=Math.abs(t.span(n))/o;let u,a,c=r.bisector(e=>e[2]).right(B,i);return c===B.length?(u=Q,a=r.tickStep(n[0]/31536e6,n[1]/31536e6,o)):c?(c=B[i/B[c-1][2]<B[c][2]/i?c-1:c],u=c[0],a=c[1]):(u=N,a=Math.max(r.tickStep(n[0],n[1],o),1)),{units:u,step:a}},e.timeFloor=function(e,t){return F(e,t||1,E,H,S)},e.timeInterval=x,e.timeOffset=function(e,t,n){return W(x(e),t,n)},e.timeSequence=function(e,t,n,r){return z(x(e),t,n,r)},e.timeUnitSpecifier=function(e,n){const r=t.extend({},D,n),o=g(e),i=o.length;let u,a,c="",s=0;for(s=0;s<i;)for(u=o.length;u>s;--u)if(a=o.slice(s,u).join("-"),null!=r[a]){c+=r[a],s=u;break}return c.trim()},e.timeUnits=g,e.utcFloor=function(e,t){return F(e,t||1,I,O,w)},e.utcInterval=A,e.utcOffset=function(e,t,n){return W(A(e),t,n)},e.utcSequence=function(e,t,n,r){return z(A(e),t,n,r)},e.utcdayofyear=function(e){return Y(new Date(e))},e.utcweek=function(e){return p(new Date(e))},e.week=function(e){return U(new Date(e))},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-time"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-time","d3-array"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.d3,e.d3)}(this,(function(e,t,n,r){"use strict";const o="year",i="quarter",u="month",a="week",c="date",s="day",l="hours",f="minutes",d="seconds",y=[o,i,u,a,c,s,"dayofyear",l,f,d,"milliseconds"],m=y.reduce((e,t,n)=>(e[t]=1+n,e),{});function g(e){const n=t.array(e).slice(),r={};n.length||t.error("Missing time unit."),n.forEach(e=>{t.hasOwnProperty(m,e)?r[e]=1:t.error(`Invalid time unit: ${e}.`)});return(r[a]||r.day?1:0)+(r[i]||r[u]||r[c]?1:0)+(r.dayofyear?1:0)>1&&t.error("Incompatible time units: "+e),n.sort((e,t)=>m[e]-m[t]),n}const D={[o]:"%Y ",[i]:"Q%q ",[u]:"%b ",[c]:"%d ",[a]:"W%U ",[s]:"%a ",dayofyear:"%j ",[l]:"%H:00",[f]:"00:%M",[d]:":%S",milliseconds:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ",["hours-"+f]:"%H:%M"};const M=new Date;function h(e){return M.setFullYear(e),M.setMonth(0),M.setDate(1),M.setHours(0,0,0,0),M}function T(e){return n.timeDay.count(h(e.getFullYear())-1,e)}function U(e){return n.timeWeek.count(h(e.getFullYear())-1,e)}function C(e){return h(e).getDay()}function S(e,t,n,r,o,i,u){if(0<=e&&e<100){const a=new Date(-1,t,n,r,o,i,u);return a.setFullYear(e),a}return new Date(e,t,n,r,o,i,u)}function Y(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcDay.count(t-1,e)}function p(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return n.utcWeek.count(t-1,e)}function w(e){return M.setTime(Date.UTC(e,0,1)),M.getUTCDay()}function v(e,t,n,r,o,i,u){if(0<=e&&e<100){const e=new Date(Date.UTC(-1,t,n,r,o,i,u));return e.setUTCFullYear(n.y),e}return new Date(Date.UTC(e,t,n,r,o,i,u))}function F(e,n,r,y,m){const g=n||1,D=t.peek(e),M=(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}(r[n=n||e],y[n],e===D&&g,t),h=new Date,T=t.toSet(e),U=T[o]?M(o):t.constant(2012),C=T[u]?M(u):T[i]?M(i):t.zero,S=T[a]&&T.day?M(s,1,a+s):T[a]?M(a,1):T.day?M(s,1):T[c]?M(c,1):T.dayofyear?M("dayofyear",1):t.one,Y=T[l]?M(l):t.zero,p=T[f]?M(f):t.zero,w=T[d]?M(d):t.zero,v=T.milliseconds?M("milliseconds"):t.zero;return function(e){h.setTime(+e);const t=U(h);return m(t,C(h),S(h,t),Y(h),p(h),w(h),v(h))}}function k(e,t,n){return t+7*e-(n+6)%7}const E={[o]:e=>e.getFullYear(),[i]:e=>Math.floor(e.getMonth()/3),[u]:e=>e.getMonth(),[c]:e=>e.getDate(),[l]:e=>e.getHours(),[f]:e=>e.getMinutes(),[d]:e=>e.getSeconds(),milliseconds:e=>e.getMilliseconds(),dayofyear:e=>T(e),[a]:e=>U(e),[a+s]:(e,t)=>k(U(e),e.getDay(),C(t)),[s]:(e,t)=>k(1,e.getDay(),C(t))},b={[i]:e=>3*e,[a]:(e,t)=>k(e,0,C(t))};const H={[o]:e=>e.getUTCFullYear(),[i]:e=>Math.floor(e.getUTCMonth()/3),[u]:e=>e.getUTCMonth(),[c]:e=>e.getUTCDate(),[l]:e=>e.getUTCHours(),[f]:e=>e.getUTCMinutes(),[d]:e=>e.getUTCSeconds(),milliseconds:e=>e.getUTCMilliseconds(),dayofyear:e=>Y(e),[a]:e=>p(e),[s]:(e,t)=>k(1,e.getUTCDay(),w(t)),[a+s]:(e,t)=>k(p(e),e.getUTCDay(),w(t))},I={[i]:e=>3*e,[a]:(e,t)=>k(e,0,w(t))};const O={[o]:n.timeYear,[i]:n.timeMonth.every(3),[u]:n.timeMonth,[a]:n.timeWeek,[c]:n.timeDay,[s]:n.timeDay,dayofyear:n.timeDay,[l]:n.timeHour,[f]:n.timeMinute,[d]:n.timeSecond,milliseconds:n.timeMillisecond},q={[o]:n.utcYear,[i]:n.utcMonth.every(3),[u]:n.utcMonth,[a]:n.utcWeek,[c]:n.utcDay,[s]:n.utcDay,dayofyear:n.utcDay,[l]:n.utcHour,[f]:n.utcMinute,[d]:n.utcSecond,milliseconds:n.utcMillisecond};function x(e){return O[e]}function A(e){return q[e]}function W(e,t,n){return e?e.offset(t,n):void 0}function z(e,t,n,r){return e?e.range(t,n,r):void 0}const N=[o,u,c,l,f,d,"milliseconds"],R=N.slice(0,-1),j=R.slice(0,-1),L=j.slice(0,-1),_=L.slice(0,-1),P=[o,u],Q=[o],B=[[R,1,1e3],[R,5,5e3],[R,15,15e3],[R,30,3e4],[j,1,6e4],[j,5,3e5],[j,15,9e5],[j,30,18e5],[L,1,36e5],[L,3,108e5],[L,6,216e5],[L,12,432e5],[_,1,864e5],[[o,a],1,6048e5],[P,1,2592e6],[P,3,7776e6],[Q,1,31536e6]];e.DATE=c,e.DAY=s,e.DAYOFYEAR="dayofyear",e.HOURS=l,e.MILLISECONDS="milliseconds",e.MINUTES=f,e.MONTH=u,e.QUARTER=i,e.SECONDS=d,e.TIME_UNITS=y,e.WEEK=a,e.YEAR=o,e.dayofyear=function(e){return T(new Date(e))},e.timeBin=function(e){const n=e.extent,o=e.maxbins||40,i=Math.abs(t.span(n))/o;let u,a,c=r.bisector(e=>e[2]).right(B,i);return c===B.length?(u=Q,a=r.tickStep(n[0]/31536e6,n[1]/31536e6,o)):c?(c=B[i/B[c-1][2]<B[c][2]/i?c-1:c],u=c[0],a=c[1]):(u=N,a=Math.max(r.tickStep(n[0],n[1],o),1)),{units:u,step:a}},e.timeFloor=function(e,t){return F(e,t||1,E,b,S)},e.timeInterval=x,e.timeOffset=function(e,t,n){return W(x(e),t,n)},e.timeSequence=function(e,t,n,r){return z(x(e),t,n,r)},e.timeUnitSpecifier=function(e,n){const r=t.extend({},D,n),o=g(e),i=o.length;let u,a,c="",s=0;for(s=0;s<i;)for(u=o.length;u>s;--u)if(a=o.slice(s,u).join("-"),null!=r[a]){c+=r[a],s=u;break}return c.trim()},e.timeUnits=g,e.utcFloor=function(e,t){return F(e,t||1,H,I,v)},e.utcInterval=A,e.utcOffset=function(e,t,n){return W(A(e),t,n)},e.utcSequence=function(e,t,n,r){return z(A(e),t,n,r)},e.utcdayofyear=function(e){return Y(new Date(e))},e.utcweek=function(e){return p(new Date(e))},e.week=function(e){return U(new Date(e))},Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "vega-time",
"version": "2.0.1",
"version": "2.0.2",
"description": "JavaScript date/time utilities for Vega.",

@@ -28,7 +28,7 @@ "keywords": [

"dependencies": {
"d3-array": "^2.4.0",
"d3-array": "^2.5.1",
"d3-time": "^1.1.0",
"vega-util": "^1.14.0"
"vega-util": "^1.15.0"
},
"gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0"
"gitHead": "28db83352e43e321dfe55fc5cb6489b211e45662"
}

@@ -35,3 +35,3 @@ import {timeDay, timeWeek, utcDay, utcWeek} from 'd3-time';

if (0 <= y && y < 100) {
var date = new Date(-1, m, d, H, M, S, L);
const date = new Date(-1, m, d, H, M, S, L);
date.setFullYear(y);

@@ -68,3 +68,3 @@ return date;

if (0 <= y && y < 100) {
var date = new Date(Date.UTC(-1, m, d, H, M, S, L));
const date = new Date(Date.UTC(-1, m, d, H, M, S, L));
date.setUTCFullYear(d.y);

@@ -71,0 +71,0 @@ return date;

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