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

d3-time-format

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-time-format - npm Package Compare versions

Comparing version 2.2.3 to 3.0.0-rc.1

16

dist/d3-time-format.js

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

// https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock
// https://d3js.org/d3-time-format/ v3.0.0-rc.1 Copyright 2020 Mike Bostock
(function (global, factory) {

@@ -269,3 +269,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-time')) :

var n = periodRe.exec(string.slice(i));
return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -275,3 +275,3 @@

var n = shortWeekdayRe.exec(string.slice(i));
return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -281,3 +281,3 @@

var n = weekdayRe.exec(string.slice(i));
return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -287,3 +287,3 @@

var n = shortMonthRe.exec(string.slice(i));
return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -293,3 +293,3 @@

var n = monthRe.exec(string.slice(i));
return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -402,5 +402,3 @@

function formatLookup(names) {
var map = {}, i = -1, n = names.length;
while (++i < n) map[names[i].toLowerCase()] = i;
return map;
return new Map(names.map((name, i) => [name.toLowerCase(), i]));
}

@@ -407,0 +405,0 @@

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

// https://d3js.org/d3-time-format/ v2.2.3 Copyright 2019 Mike Bostock
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-time")):"function"==typeof define&&define.amd?define(["exports","d3-time"],n):n((e=e||self).d3=e.d3||{},e.d3)}(this,function(e,n){"use strict";function t(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function r(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function u(e,n,t){return{y:e,m:n,d:t,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,c=e.date,a=e.time,f=e.periods,l=e.days,s=e.shortDays,g=e.months,Me=e.shortMonths,Te=y(f),De=d(f),Ce=y(l),xe=d(l),Ue=y(s),we=d(s),pe=y(g),Se=d(g),Ye=y(Me),Le=d(Me),Fe={a:function(e){return s[e.getDay()]},A:function(e){return l[e.getDay()]},b:function(e){return Me[e.getMonth()]},B:function(e){return g[e.getMonth()]},c:null,d:V,e:V,f:J,H:j,I:P,j:q,L:I,m:O,M:Q,p:function(e){return f[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:me,s:ve,S:X,u:N,U:B,V:_,w:$,W:z,x:null,X:null,y:E,Y:R,Z:k,"%":he},He={a:function(e){return s[e.getUTCDay()]},A:function(e){return l[e.getUTCDay()]},b:function(e){return Me[e.getUTCMonth()]},B:function(e){return g[e.getUTCMonth()]},c:null,d:G,e:G,f:re,H:K,I:ee,j:ne,L:te,m:ue,M:ie,p:function(e){return f[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:me,s:ve,S:ce,u:oe,U:ae,V:fe,w:le,W:se,x:null,X:null,y:ge,Y:ye,Z:de,"%":he},Ae={a:function(e,n,t){var r=Ue.exec(n.slice(t));return r?(e.w=we[r[0].toLowerCase()],t+r[0].length):-1},A:function(e,n,t){var r=Ce.exec(n.slice(t));return r?(e.w=xe[r[0].toLowerCase()],t+r[0].length):-1},b:function(e,n,t){var r=Ye.exec(n.slice(t));return r?(e.m=Le[r[0].toLowerCase()],t+r[0].length):-1},B:function(e,n,t){var r=pe.exec(n.slice(t));return r?(e.m=Se[r[0].toLowerCase()],t+r[0].length):-1},c:function(e,n,t){return We(e,i,n,t)},d:p,e:p,f:A,H:Y,I:Y,j:S,L:H,m:w,M:L,p:function(e,n,t){var r=Te.exec(n.slice(t));return r?(e.p=De[r[0].toLowerCase()],t+r[0].length):-1},q:U,Q:b,s:W,S:F,u:m,U:v,V:M,w:h,W:T,x:function(e,n,t){return We(e,c,n,t)},X:function(e,n,t){return We(e,a,n,t)},y:C,Y:D,Z:x,"%":Z};function Ze(e,n){return function(t){var r,u,i,c=[],a=-1,f=0,l=e.length;for(t instanceof Date||(t=new Date(+t));++a<l;)37===e.charCodeAt(a)&&(c.push(e.slice(f,a)),null!=(u=o[r=e.charAt(++a)])?r=e.charAt(++a):u="e"===r?" ":"0",(i=n[r])&&(r=i(t,u)),c.push(r),f=a+1);return c.push(e.slice(f,a)),c.join("")}}function be(e,i){return function(c){var o,a,f=u(1900,void 0,1);if(We(f,e,c+="",0)!=c.length)return null;if("Q"in f)return new Date(f.Q);if("s"in f)return new Date(1e3*f.s+("L"in f?f.L:0));if(!i||"Z"in f||(f.Z=0),"p"in f&&(f.H=f.H%12+12*f.p),void 0===f.m&&(f.m="q"in f?f.q:0),"V"in f){if(f.V<1||f.V>53)return null;"w"in f||(f.w=1),"Z"in f?(a=(o=r(u(f.y,0,1))).getUTCDay(),o=a>4||0===a?n.utcMonday.ceil(o):n.utcMonday(o),o=n.utcDay.offset(o,7*(f.V-1)),f.y=o.getUTCFullYear(),f.m=o.getUTCMonth(),f.d=o.getUTCDate()+(f.w+6)%7):(a=(o=t(u(f.y,0,1))).getDay(),o=a>4||0===a?n.timeMonday.ceil(o):n.timeMonday(o),o=n.timeDay.offset(o,7*(f.V-1)),f.y=o.getFullYear(),f.m=o.getMonth(),f.d=o.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),a="Z"in f?r(u(f.y,0,1)).getUTCDay():t(u(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+7*f.W-(a+5)%7:f.w+7*f.U-(a+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,r(f)):t(f)}}function We(e,n,t,r){for(var u,i,c=0,a=n.length,f=t.length;c<a;){if(r>=f)return-1;if(37===(u=n.charCodeAt(c++))){if(u=n.charAt(c++),!(i=Ae[u in o?n.charAt(c++):u])||(r=i(e,t,r))<0)return-1}else if(u!=t.charCodeAt(r++))return-1}return r}return Fe.x=Ze(c,Fe),Fe.X=Ze(a,Fe),Fe.c=Ze(i,Fe),He.x=Ze(c,He),He.X=Ze(a,He),He.c=Ze(i,He),{format:function(e){var n=Ze(e+="",Fe);return n.toString=function(){return e},n},parse:function(e){var n=be(e+="",!1);return n.toString=function(){return e},n},utcFormat:function(e){var n=Ze(e+="",He);return n.toString=function(){return e},n},utcParse:function(e){var n=be(e+="",!0);return n.toString=function(){return e},n}}}var c,o={"-":"",_:" ",0:"0"},a=/^\s*\d+/,f=/^%/,l=/[\\^$*+?|[\]().{}]/g;function s(e,n,t){var r=e<0?"-":"",u=(r?-e:e)+"",i=u.length;return r+(i<t?new Array(t-i+1).join(n)+u:u)}function g(e){return e.replace(l,"\\$&")}function y(e){return new RegExp("^(?:"+e.map(g).join("|")+")","i")}function d(e){for(var n={},t=-1,r=e.length;++t<r;)n[e[t].toLowerCase()]=t;return n}function h(e,n,t){var r=a.exec(n.slice(t,t+1));return r?(e.w=+r[0],t+r[0].length):-1}function m(e,n,t){var r=a.exec(n.slice(t,t+1));return r?(e.u=+r[0],t+r[0].length):-1}function v(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.U=+r[0],t+r[0].length):-1}function M(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.V=+r[0],t+r[0].length):-1}function T(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.W=+r[0],t+r[0].length):-1}function D(e,n,t){var r=a.exec(n.slice(t,t+4));return r?(e.y=+r[0],t+r[0].length):-1}function C(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function x(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function U(e,n,t){var r=a.exec(n.slice(t,t+1));return r?(e.q=3*r[0]-3,t+r[0].length):-1}function w(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function p(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function S(e,n,t){var r=a.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function Y(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function L(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function F(e,n,t){var r=a.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function H(e,n,t){var r=a.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function A(e,n,t){var r=a.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function Z(e,n,t){var r=f.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function b(e,n,t){var r=a.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function W(e,n,t){var r=a.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function V(e,n){return s(e.getDate(),n,2)}function j(e,n){return s(e.getHours(),n,2)}function P(e,n){return s(e.getHours()%12||12,n,2)}function q(e,t){return s(1+n.timeDay.count(n.timeYear(e),e),t,3)}function I(e,n){return s(e.getMilliseconds(),n,3)}function J(e,n){return I(e,n)+"000"}function O(e,n){return s(e.getMonth()+1,n,2)}function Q(e,n){return s(e.getMinutes(),n,2)}function X(e,n){return s(e.getSeconds(),n,2)}function N(e){var n=e.getDay();return 0===n?7:n}function B(e,t){return s(n.timeSunday.count(n.timeYear(e)-1,e),t,2)}function _(e,t){var r=e.getDay();return e=r>=4||0===r?n.timeThursday(e):n.timeThursday.ceil(e),s(n.timeThursday.count(n.timeYear(e),e)+(4===n.timeYear(e).getDay()),t,2)}function $(e){return e.getDay()}function z(e,t){return s(n.timeMonday.count(n.timeYear(e)-1,e),t,2)}function E(e,n){return s(e.getFullYear()%100,n,2)}function R(e,n){return s(e.getFullYear()%1e4,n,4)}function k(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+s(n/60|0,"0",2)+s(n%60,"0",2)}function G(e,n){return s(e.getUTCDate(),n,2)}function K(e,n){return s(e.getUTCHours(),n,2)}function ee(e,n){return s(e.getUTCHours()%12||12,n,2)}function ne(e,t){return s(1+n.utcDay.count(n.utcYear(e),e),t,3)}function te(e,n){return s(e.getUTCMilliseconds(),n,3)}function re(e,n){return te(e,n)+"000"}function ue(e,n){return s(e.getUTCMonth()+1,n,2)}function ie(e,n){return s(e.getUTCMinutes(),n,2)}function ce(e,n){return s(e.getUTCSeconds(),n,2)}function oe(e){var n=e.getUTCDay();return 0===n?7:n}function ae(e,t){return s(n.utcSunday.count(n.utcYear(e)-1,e),t,2)}function fe(e,t){var r=e.getUTCDay();return e=r>=4||0===r?n.utcThursday(e):n.utcThursday.ceil(e),s(n.utcThursday.count(n.utcYear(e),e)+(4===n.utcYear(e).getUTCDay()),t,2)}function le(e){return e.getUTCDay()}function se(e,t){return s(n.utcMonday.count(n.utcYear(e)-1,e),t,2)}function ge(e,n){return s(e.getUTCFullYear()%100,n,2)}function ye(e,n){return s(e.getUTCFullYear()%1e4,n,4)}function de(){return"+0000"}function he(){return"%"}function me(e){return+e}function ve(e){return Math.floor(+e/1e3)}function Me(n){return c=i(n),e.timeFormat=c.format,e.timeParse=c.parse,e.utcFormat=c.utcFormat,e.utcParse=c.utcParse,c}Me({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Te=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var De=+new Date("2000-01-01T00:00:00.000Z")?function(e){var n=new Date(e);return isNaN(n)?null:n}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=Te,e.isoParse=De,e.timeFormatDefaultLocale=Me,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})});
// https://d3js.org/d3-time-format/ v3.0.0-rc.1 Copyright 2020 Mike Bostock
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-time")):"function"==typeof define&&define.amd?define(["exports","d3-time"],t):t((e=e||self).d3=e.d3||{},e.d3)}(this,function(e,t){"use strict";function n(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function r(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function u(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function i(e){var i=e.dateTime,c=e.date,a=e.time,f=e.periods,l=e.days,s=e.shortDays,g=e.months,Me=e.shortMonths,Te=y(f),De=d(f),Ce=y(l),xe=d(l),Ue=y(s),pe=d(s),we=y(g),Se=d(g),Ye=y(Me),Le=d(Me),Fe={a:function(e){return s[e.getDay()]},A:function(e){return l[e.getDay()]},b:function(e){return Me[e.getMonth()]},B:function(e){return g[e.getMonth()]},c:null,d:V,e:V,f:J,H:j,I:P,j:q,L:I,m:O,M:Q,p:function(e){return f[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:me,s:ve,S:X,u:N,U:B,V:_,w:$,W:z,x:null,X:null,y:E,Y:R,Z:k,"%":he},He={a:function(e){return s[e.getUTCDay()]},A:function(e){return l[e.getUTCDay()]},b:function(e){return Me[e.getUTCMonth()]},B:function(e){return g[e.getUTCMonth()]},c:null,d:G,e:G,f:re,H:K,I:ee,j:te,L:ne,m:ue,M:ie,p:function(e){return f[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:me,s:ve,S:ce,u:oe,U:ae,V:fe,w:le,W:se,x:null,X:null,y:ge,Y:ye,Z:de,"%":he},Ae={a:function(e,t,n){var r=Ue.exec(t.slice(n));return r?(e.w=pe.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=Ce.exec(t.slice(n));return r?(e.w=xe.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=Ye.exec(t.slice(n));return r?(e.m=Le.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=we.exec(t.slice(n));return r?(e.m=Se.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,t,n){return We(e,i,t,n)},d:w,e:w,f:A,H:Y,I:Y,j:S,L:H,m:p,M:L,p:function(e,t,n){var r=Te.exec(t.slice(n));return r?(e.p=De.get(r[0].toLowerCase()),n+r[0].length):-1},q:U,Q:b,s:W,S:F,u:m,U:v,V:M,w:h,W:T,x:function(e,t,n){return We(e,c,t,n)},X:function(e,t,n){return We(e,a,t,n)},y:C,Y:D,Z:x,"%":Z};function Ze(e,t){return function(n){var r,u,i,c=[],a=-1,f=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++a<l;)37===e.charCodeAt(a)&&(c.push(e.slice(f,a)),null!=(u=o[r=e.charAt(++a)])?r=e.charAt(++a):u="e"===r?" ":"0",(i=t[r])&&(r=i(n,u)),c.push(r),f=a+1);return c.push(e.slice(f,a)),c.join("")}}function be(e,i){return function(c){var o,a,f=u(1900,void 0,1);if(We(f,e,c+="",0)!=c.length)return null;if("Q"in f)return new Date(f.Q);if("s"in f)return new Date(1e3*f.s+("L"in f?f.L:0));if(!i||"Z"in f||(f.Z=0),"p"in f&&(f.H=f.H%12+12*f.p),void 0===f.m&&(f.m="q"in f?f.q:0),"V"in f){if(f.V<1||f.V>53)return null;"w"in f||(f.w=1),"Z"in f?(a=(o=r(u(f.y,0,1))).getUTCDay(),o=a>4||0===a?t.utcMonday.ceil(o):t.utcMonday(o),o=t.utcDay.offset(o,7*(f.V-1)),f.y=o.getUTCFullYear(),f.m=o.getUTCMonth(),f.d=o.getUTCDate()+(f.w+6)%7):(a=(o=n(u(f.y,0,1))).getDay(),o=a>4||0===a?t.timeMonday.ceil(o):t.timeMonday(o),o=t.timeDay.offset(o,7*(f.V-1)),f.y=o.getFullYear(),f.m=o.getMonth(),f.d=o.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),a="Z"in f?r(u(f.y,0,1)).getUTCDay():n(u(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+7*f.W-(a+5)%7:f.w+7*f.U-(a+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,r(f)):n(f)}}function We(e,t,n,r){for(var u,i,c=0,a=t.length,f=n.length;c<a;){if(r>=f)return-1;if(37===(u=t.charCodeAt(c++))){if(u=t.charAt(c++),!(i=Ae[u in o?t.charAt(c++):u])||(r=i(e,n,r))<0)return-1}else if(u!=n.charCodeAt(r++))return-1}return r}return Fe.x=Ze(c,Fe),Fe.X=Ze(a,Fe),Fe.c=Ze(i,Fe),He.x=Ze(c,He),He.X=Ze(a,He),He.c=Ze(i,He),{format:function(e){var t=Ze(e+="",Fe);return t.toString=function(){return e},t},parse:function(e){var t=be(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=Ze(e+="",He);return t.toString=function(){return e},t},utcParse:function(e){var t=be(e+="",!0);return t.toString=function(){return e},t}}}var c,o={"-":"",_:" ",0:"0"},a=/^\s*\d+/,f=/^%/,l=/[\\^$*+?|[\]().{}]/g;function s(e,t,n){var r=e<0?"-":"",u=(r?-e:e)+"",i=u.length;return r+(i<n?new Array(n-i+1).join(t)+u:u)}function g(e){return e.replace(l,"\\$&")}function y(e){return new RegExp("^(?:"+e.map(g).join("|")+")","i")}function d(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function h(e,t,n){var r=a.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function m(e,t,n){var r=a.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function v(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function M(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function T(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function D(e,t,n){var r=a.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function C(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function x(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function U(e,t,n){var r=a.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function p(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function w(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function S(e,t,n){var r=a.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Y(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function L(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function F(e,t,n){var r=a.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function H(e,t,n){var r=a.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function A(e,t,n){var r=a.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Z(e,t,n){var r=f.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function b(e,t,n){var r=a.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function W(e,t,n){var r=a.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function V(e,t){return s(e.getDate(),t,2)}function j(e,t){return s(e.getHours(),t,2)}function P(e,t){return s(e.getHours()%12||12,t,2)}function q(e,n){return s(1+t.timeDay.count(t.timeYear(e),e),n,3)}function I(e,t){return s(e.getMilliseconds(),t,3)}function J(e,t){return I(e,t)+"000"}function O(e,t){return s(e.getMonth()+1,t,2)}function Q(e,t){return s(e.getMinutes(),t,2)}function X(e,t){return s(e.getSeconds(),t,2)}function N(e){var t=e.getDay();return 0===t?7:t}function B(e,n){return s(t.timeSunday.count(t.timeYear(e)-1,e),n,2)}function _(e,n){var r=e.getDay();return e=r>=4||0===r?t.timeThursday(e):t.timeThursday.ceil(e),s(t.timeThursday.count(t.timeYear(e),e)+(4===t.timeYear(e).getDay()),n,2)}function $(e){return e.getDay()}function z(e,n){return s(t.timeMonday.count(t.timeYear(e)-1,e),n,2)}function E(e,t){return s(e.getFullYear()%100,t,2)}function R(e,t){return s(e.getFullYear()%1e4,t,4)}function k(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+s(t/60|0,"0",2)+s(t%60,"0",2)}function G(e,t){return s(e.getUTCDate(),t,2)}function K(e,t){return s(e.getUTCHours(),t,2)}function ee(e,t){return s(e.getUTCHours()%12||12,t,2)}function te(e,n){return s(1+t.utcDay.count(t.utcYear(e),e),n,3)}function ne(e,t){return s(e.getUTCMilliseconds(),t,3)}function re(e,t){return ne(e,t)+"000"}function ue(e,t){return s(e.getUTCMonth()+1,t,2)}function ie(e,t){return s(e.getUTCMinutes(),t,2)}function ce(e,t){return s(e.getUTCSeconds(),t,2)}function oe(e){var t=e.getUTCDay();return 0===t?7:t}function ae(e,n){return s(t.utcSunday.count(t.utcYear(e)-1,e),n,2)}function fe(e,n){var r=e.getUTCDay();return e=r>=4||0===r?t.utcThursday(e):t.utcThursday.ceil(e),s(t.utcThursday.count(t.utcYear(e),e)+(4===t.utcYear(e).getUTCDay()),n,2)}function le(e){return e.getUTCDay()}function se(e,n){return s(t.utcMonday.count(t.utcYear(e)-1,e),n,2)}function ge(e,t){return s(e.getUTCFullYear()%100,t,2)}function ye(e,t){return s(e.getUTCFullYear()%1e4,t,4)}function de(){return"+0000"}function he(){return"%"}function me(e){return+e}function ve(e){return Math.floor(+e/1e3)}function Me(t){return c=i(t),e.timeFormat=c.format,e.timeParse=c.parse,e.utcFormat=c.utcFormat,e.utcParse=c.utcParse,c}Me({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Te=Date.prototype.toISOString?function(e){return e.toISOString()}:e.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var De=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:e.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");e.isoFormat=Te,e.isoParse=De,e.timeFormatDefaultLocale=Me,e.timeFormatLocale=i,Object.defineProperty(e,"__esModule",{value:!0})});
{
"dateTime": "%A, le %e %B %Y, %X",
"dateTime": "%A %e %B %Y à %X",
"date": "%d/%m/%Y",

@@ -4,0 +4,0 @@ "time": "%H:%M:%S",

{
"dateTime": "%Y %b %e %a %X",
"dateTime": "%x %a %X",
"date": "%Y/%m/%d",

@@ -8,4 +8,4 @@ "time": "%H:%M:%S",

"shortDays": ["日", "月", "火", "水", "木", "金", "土"],
"months": ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"],
"months": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
"shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
}
{
"dateTime": "%a %e %B %Y %T",
"dateTime": "%a %e %B %Y %X",
"date": "%d-%m-%Y",

@@ -4,0 +4,0 @@ "time": "%H:%M:%S",

@@ -7,5 +7,5 @@ {

"days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
"shortDays": ["週日", "週一", "週二", "週三", "週四", "週五", "週六"],
"shortDays": ["日", "一", "二", "三", "四", "五", "六"],
"months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
}
{
"name": "d3-time-format",
"version": "2.2.3",
"version": "3.0.0-rc.1",
"publishConfig": {
"tag": "next"
},
"description": "A JavaScript time formatter and parser inspired by strftime and strptime.",

@@ -39,3 +42,3 @@ "keywords": [

"dependencies": {
"d3-time": "1"
"d3-time": ">=2.0.0-rc.1"
},

@@ -46,3 +49,2 @@ "sideEffects": [

"devDependencies": {
"d3-queue": "3",
"eslint": "6",

@@ -49,0 +51,0 @@ "rollup": "1",

@@ -17,3 +17,3 @@ # d3-time-format

You can implement more elaborate conditional time formats, too. For example, here’s a [multi-scale time format](http://bl.ocks.org/mbostock/4149176) using [time intervals](https://github.com/d3/d3-time):
You can implement more elaborate conditional time formats, too. For example, here’s a [multi-scale time format](https://bl.ocks.org/mbostock/4149176) using [time intervals](https://github.com/d3/d3-time):

@@ -48,4 +48,4 @@ ```js

```html
<script src="https://d3js.org/d3-time.v1.min.js"></script>
<script src="https://d3js.org/d3-time-format.v2.min.js"></script>
<script src="https://d3js.org/d3-time.v2.min.js"></script>
<script src="https://d3js.org/d3-time-format.v3.min.js"></script>
<script>

@@ -61,3 +61,3 @@

```js
d3.json("https://cdn.jsdelivr.net/npm/d3-time-format@2/locale/ru-RU.json", function(error, locale) {
d3.json("https://cdn.jsdelivr.net/npm/d3-time-format@3/locale/ru-RU.json", function(error, locale) {
if (error) throw error;

@@ -75,23 +75,23 @@

<a name="timeFormat" href="#timeFormat">#</a> d3.<b>timeFormat</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L4 "Source")
<a name="timeFormat" href="#timeFormat">#</a> d3.<b>timeFormat</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js)
An alias for [*locale*.format](#locale_format) on the [default locale](#timeFormatDefaultLocale).
<a name="timeParse" href="#timeParse">#</a> d3.<b>timeParse</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L5 "Source")
<a name="timeParse" href="#timeParse">#</a> d3.<b>timeParse</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js)
An alias for [*locale*.parse](#locale_parse) on the [default locale](#timeFormatDefaultLocale).
<a name="utcFormat" href="#utcFormat">#</a> d3.<b>utcFormat</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L6 "Source")
<a name="utcFormat" href="#utcFormat">#</a> d3.<b>utcFormat</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js)
An alias for [*locale*.utcFormat](#locale_utcFormat) on the [default locale](#timeFormatDefaultLocale).
<a name="utcParse" href="#utcParse">#</a> d3.<b>utcParse</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L7 "Source")
<a name="utcParse" href="#utcParse">#</a> d3.<b>utcParse</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js)
An alias for [*locale*.utcParse](#locale_utcParse) on the [default locale](#timeFormatDefaultLocale).
<a name="isoFormat" href="#isoFormat">#</a> d3.<b>isoFormat</b> [<>](https://github.com/d3/d3-time-format/blob/master/src/isoFormat.js "Source")
<a name="isoFormat" href="#isoFormat">#</a> d3.<b>isoFormat</b> · [Source](https://github.com/d3/d3-time-format/blob/master/src/isoFormat.js)
The full [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC time formatter. Where available, this method will use [Date.toISOString](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString) to format.
<a name="isoParse" href="#isoParse">#</a> d3.<b>isoParse</b> [<>](https://github.com/d3/d3-time-format/blob/master/src/isoParse.js "Source")
<a name="isoParse" href="#isoParse">#</a> d3.<b>isoParse</b> · [Source](https://github.com/d3/d3-time-format/blob/master/src/isoParse.js)

@@ -104,3 +104,3 @@ The full [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC time parser. Where available, this method will use the [Date constructor](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date) to parse strings. If you depend on strict validation of the input format according to ISO 8601, you should construct a [UTC parser function](#utcParse):

<a name="locale_format" href="#locale_format">#</a> <i>locale</i>.<b>format</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L293 "Source")
<a name="locale_format" href="#locale_format">#</a> <i>locale</i>.<b>format</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/locale.js)

@@ -140,3 +140,3 @@ Returns a new formatter for the given string *specifier*. The specifier string may contain the following directives:

Directives marked with an asterisk (\*) may be affected by the [locale definition](#localeFormat).
Directives marked with an asterisk (\*) may be affected by the [locale definition](#locales).

@@ -168,3 +168,3 @@ For `%U`, all days in a new year preceding the first Sunday are considered to be in week 0. For `%W`, all days in a new year preceding the first Monday are considered to be in week 0. Week numbers are computed using [*interval*.count](https://github.com/d3/d3-time/blob/master/README.md#interval_count). For example, 2015-52 and 2016-00 represent Monday, December 28, 2015, while 2015-53 and 2016-01 represent Monday, January 4, 2016. This differs from the [ISO week date](https://en.wikipedia.org/wiki/ISO_week_date) specification (`%V`), which uses a more complicated definition!

<a name="locale_parse" href="#locale_parse">#</a> <i>locale</i>.<b>parse</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L298 "Source")
<a name="locale_parse" href="#locale_parse">#</a> <i>locale</i>.<b>parse</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/locale.js)

@@ -175,7 +175,7 @@ Returns a new parser for the given string *specifier*. The specifier string may contain the same directives as [*locale*.format](#locale_format). The `%d` and `%e` directives are considered equivalent for parsing.

<a name="locale_utcFormat" href="#locale_utcFormat">#</a> <i>locale</i>.<b>utcFormat</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L303 "Source")
<a name="locale_utcFormat" href="#locale_utcFormat">#</a> <i>locale</i>.<b>utcFormat</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/locale.js)
Equivalent to [*locale*.format](#locale_format), except all directives are interpreted as [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) rather than local time.
<a name="locale_utcParse" href="#locale_utcParse">#</a> <i>locale</i>.<b>utcParse</b>(<i>specifier</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L308 "Source")
<a name="locale_utcParse" href="#locale_utcParse">#</a> <i>locale</i>.<b>utcParse</b>(<i>specifier</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/locale.js)

@@ -186,3 +186,3 @@ Equivalent to [*locale*.parse](#locale_parse), except all directives are interpreted as [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) rather than local time.

<a name="timeFormatLocale" href="#timeFormatLocale">#</a> d3.<b>timeFormatLocale</b>(<i>definition</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js "Source")
<a name="timeFormatLocale" href="#timeFormatLocale">#</a> d3.<b>timeFormatLocale</b>(<i>definition</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/locale.js)

@@ -202,3 +202,3 @@ Returns a *locale* object for the specified *definition* with [*locale*.format](#locale_format), [*locale*.parse](#locale_parse), [*locale*.utcFormat](#locale_utcFormat), [*locale*.utcParse](#locale_utcParse) methods. The *definition* must include the following properties:

<a name="timeFormatDefaultLocale" href="#timeFormatDefaultLocale">#</a> d3.<b>timeFormatDefaultLocale</b>(<i>definition</i>) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js "Source")
<a name="timeFormatDefaultLocale" href="#timeFormatDefaultLocale">#</a> d3.<b>timeFormatDefaultLocale</b>(<i>definition</i>) · [Source](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js)

@@ -205,0 +205,0 @@ Equivalent to [d3.timeFormatLocale](#timeFormatLocale), except it also redefines [d3.timeFormat](#timeFormat), [d3.timeParse](#timeParse), [d3.utcFormat](#utcFormat) and [d3.utcParse](#utcParse) to the new locale’s [*locale*.format](#locale_format), [*locale*.parse](#locale_parse), [*locale*.utcFormat](#locale_utcFormat) and [*locale*.utcParse](#locale_utcParse). If you do not set a default locale, it defaults to [U.S. English](https://github.com/d3/d3-time-format/blob/master/locale/en-US.json).

@@ -275,3 +275,3 @@ import {

var n = periodRe.exec(string.slice(i));
return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -281,3 +281,3 @@

var n = shortWeekdayRe.exec(string.slice(i));
return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -287,3 +287,3 @@

var n = weekdayRe.exec(string.slice(i));
return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -293,3 +293,3 @@

var n = shortMonthRe.exec(string.slice(i));
return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -299,3 +299,3 @@

var n = monthRe.exec(string.slice(i));
return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
}

@@ -408,5 +408,3 @@

function formatLookup(names) {
var map = {}, i = -1, n = names.length;
while (++i < n) map[names[i].toLowerCase()] = i;
return map;
return new Map(names.map((name, i) => [name.toLowerCase(), i]));
}

@@ -413,0 +411,0 @@

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