pax_global_header 0000666 0000000 0000000 00000000064 13340071377 0014517 g ustar 00root root 0000000 0000000 52 comment=da8ef470f3da813958b33cb97a93f7267dfc0857
d3-time-format-2.1.3/ 0000775 0000000 0000000 00000000000 13340071377 0014252 5 ustar 00root root 0000000 0000000 d3-time-format-2.1.3/.eslintrc.json 0000664 0000000 0000000 00000000342 13340071377 0017045 0 ustar 00root root 0000000 0000000 {
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"rules": {
"no-cond-assign": 0
}
}
d3-time-format-2.1.3/.gitignore 0000664 0000000 0000000 00000000077 13340071377 0016246 0 ustar 00root root 0000000 0000000 *.sublime-workspace
.DS_Store
dist/
node_modules
npm-debug.log
d3-time-format-2.1.3/.npmignore 0000664 0000000 0000000 00000000042 13340071377 0016245 0 ustar 00root root 0000000 0000000 *.sublime-*
dist/*.zip
img/
test/
d3-time-format-2.1.3/LICENSE 0000664 0000000 0000000 00000002703 13340071377 0015261 0 ustar 00root root 0000000 0000000 Copyright 2010-2017 Mike Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
d3-time-format-2.1.3/README.md 0000664 0000000 0000000 00000031474 13340071377 0015542 0 ustar 00root root 0000000 0000000 # d3-time-format
This module provides a JavaScript implementation of the venerable [strptime](http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html) and [strftime](http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html) functions from the C standard library, and can be used to parse or format [dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) in a variety of locale-specific representations. To format a date, create a [formatter](#locale_format) from a specifier (a string with the desired format *directives*, indicated by `%`); then pass a date to the formatter, which returns a string. For example, to convert the current date to a human-readable string:
```js
var formatTime = d3.timeFormat("%B %d, %Y");
formatTime(new Date); // "June 30, 2015"
```
Likewise, to convert a string back to a date, create a [parser](#locale_parse):
```js
var parseTime = d3.timeParse("%B %d, %Y");
parseTime("June 30, 2015"); // Tue Jun 30 2015 00:00:00 GMT-0700 (PDT)
```
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):
```js
var formatMillisecond = d3.timeFormat(".%L"),
formatSecond = d3.timeFormat(":%S"),
formatMinute = d3.timeFormat("%I:%M"),
formatHour = d3.timeFormat("%I %p"),
formatDay = d3.timeFormat("%a %d"),
formatWeek = d3.timeFormat("%b %d"),
formatMonth = d3.timeFormat("%B"),
formatYear = d3.timeFormat("%Y");
function multiFormat(date) {
return (d3.timeSecond(date) < date ? formatMillisecond
: d3.timeMinute(date) < date ? formatSecond
: d3.timeHour(date) < date ? formatMinute
: d3.timeDay(date) < date ? formatHour
: d3.timeMonth(date) < date ? (d3.timeWeek(date) < date ? formatDay : formatWeek)
: d3.timeYear(date) < date ? formatMonth
: formatYear)(date);
}
```
This module is used by D3 [time scales](https://github.com/d3/d3-scale/blob/master/README.md#time-scales) to generate human-readable ticks.
## Installing
If you use NPM, `npm install d3-time-format`. Otherwise, download the [latest release](https://github.com/d3/d3-time-format/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-time-format.v2.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:
```html
```
Locale files are hosted on [unpkg](https://unpkg.com/) and can be loaded using [d3.json](https://github.com/d3/d3-request/blob/master/README.md#json). For example, to set Russian as the default locale:
```js
d3.json("https://unpkg.com/d3-time-format@2/locale/ru-RU.json", function(error, locale) {
if (error) throw error;
d3.timeFormatDefaultLocale(locale);
var format = d3.timeFormat("%c");
console.log(format(new Date)); // понедельник, 5 декабря 2016 г. 10:31:59
});
```
[Try d3-time-format in your browser.](https://tonicdev.com/npm/d3-time-format)
## API Reference
# d3.timeFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L4 "Source")
An alias for [*locale*.format](#locale_format) on the [default locale](#timeFormatDefaultLocale).
# d3.timeParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L5 "Source")
An alias for [*locale*.parse](#locale_parse) on the [default locale](#timeFormatDefaultLocale).
# d3.utcFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L6 "Source")
An alias for [*locale*.utcFormat](#locale_utcFormat) on the [default locale](#timeFormatDefaultLocale).
# d3.utcParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js#L7 "Source")
An alias for [*locale*.utcParse](#locale_utcParse) on the [default locale](#timeFormatDefaultLocale).
# d3.isoFormat [<>](https://github.com/d3/d3-time-format/blob/master/src/isoFormat.js "Source")
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.
# d3.isoParse [<>](https://github.com/d3/d3-time-format/blob/master/src/isoParse.js "Source")
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):
```js
var strictIsoParse = d3.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");
```
# locale.format(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L293 "Source")
Returns a new formatter for the given string *specifier*. The specifier string may contain the following directives:
* `%a` - abbreviated weekday name.*
* `%A` - full weekday name.*
* `%b` - abbreviated month name.*
* `%B` - full month name.*
* `%c` - the locale’s date and time, such as `%x, %X`.*
* `%d` - zero-padded day of the month as a decimal number [01,31].
* `%e` - space-padded day of the month as a decimal number [ 1,31]; equivalent to `%_d`.
* `%f` - microseconds as a decimal number [000000, 999999].
* `%H` - hour (24-hour clock) as a decimal number [00,23].
* `%I` - hour (12-hour clock) as a decimal number [01,12].
* `%j` - day of the year as a decimal number [001,366].
* `%m` - month as a decimal number [01,12].
* `%M` - minute as a decimal number [00,59].
* `%L` - milliseconds as a decimal number [000, 999].
* `%p` - either AM or PM.*
* `%Q` - milliseconds since UNIX epoch.
* `%s` - seconds since UNIX epoch.
* `%S` - second as a decimal number [00,61].
* `%u` - Monday-based (ISO 8601) weekday as a decimal number [1,7].
* `%U` - Sunday-based week of the year as a decimal number [00,53].
* `%V` - ISO 8601 week of the year as a decimal number [01, 53].
* `%w` - Sunday-based weekday as a decimal number [0,6].
* `%W` - Monday-based week of the year as a decimal number [00,53].
* `%x` - the locale’s date, such as `%-m/%-d/%Y`.*
* `%X` - the locale’s time, such as `%-I:%M:%S %p`.*
* `%y` - year without century as a decimal number [00,99].
* `%Y` - year with century as a decimal number.
* `%Z` - time zone offset, such as `-0700`, `-07:00`, `-07`, or `Z`.
* `%%` - a literal percent sign (`%`).
Directives marked with an asterisk (\*) may be affected by the [locale definition](#localeFormat).
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!
For `%V`, per the [strftime man page](http://man7.org/linux/man-pages/man3/strftime.3.html):
> In this system, weeks start on a Monday, and are numbered from 01, for the first week, up to 52 or 53, for the last week. Week 1 is the first week where four or more days fall within the new year (or, synonymously, week 01 is: the first week of the year that contains a Thursday; or, the week that has 4 January in it).
The `%` sign indicating a directive may be immediately followed by a padding modifier:
* `0` - zero-padding
* `_` - space-padding
* `-` - disable padding
If no padding modifier is specified, the default is `0` for all directives except `%e`, which defaults to `_`. (In some implementations of strftime and strptime, a directive may include an optional field width or precision; this feature is not yet implemented.)
The returned function formats a specified *[date](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date)*, returning the corresponding string.
```js
var formatMonth = d3.timeFormat("%B"),
formatDay = d3.timeFormat("%A"),
date = new Date(2014, 4, 1); // Thu May 01 2014 00:00:00 GMT-0700 (PDT)
formatMonth(date); // "May"
formatDay(date); // "Thursday"
```
# locale.parse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L298 "Source")
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.
The returned function parses a specified *string*, returning the corresponding [date](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date) or null if the string could not be parsed according to this format’s specifier. Parsing is strict: if the specified string does not exactly match the associated specifier, this method returns null. For example, if the associated specifier is `%Y-%m-%dT%H:%M:%SZ`, then the string `"2011-07-01T19:15:28Z"` will be parsed as expected, but `"2011-07-01T19:15:28"`, `"2011-07-01 19:15:28"` and `"2011-07-01"` will return null. (Note that the literal `Z` here is different from the time zone offset directive `%Z`.) If a more flexible parser is desired, try multiple formats sequentially until one returns non-null.
# locale.utcFormat(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L303 "Source")
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.
# locale.utcParse(specifier) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js#L308 "Source")
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.
### Locales
# d3.timeFormatLocale(definition) [<>](https://github.com/d3/d3-time-format/blob/master/src/locale.js "Source")
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:
* `dateTime` - the date and time (`%c`) format specifier (e.g., `"%a %b %e %X %Y"`).
* `date` - the date (`%x`) format specifier (e.g., `"%m/%d/%Y"`).
* `time` - the time (`%X`) format specifier (e.g., `"%H:%M:%S"`).
* `periods` - the A.M. and P.M. equivalents (e.g., `["AM", "PM"]`).
* `days` - the full names of the weekdays, starting with Sunday.
* `shortDays` - the abbreviated names of the weekdays, starting with Sunday.
* `months` - the full names of the months (starting with January).
* `shortMonths` - the abbreviated names of the months (starting with January).
For an example, see [Localized Time Axis II](https://bl.ocks.org/mbostock/805115ebaa574e771db1875a6d828949).
# d3.timeFormatDefaultLocale(definition) [<>](https://github.com/d3/d3-time-format/blob/master/src/defaultLocale.js "Source")
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).
For an example, see [Localized Time Axis](https://bl.ocks.org/mbostock/6f1cc065d4d172bcaf322e399aa8d62f).
d3-time-format-2.1.3/d3-time-format.sublime-project 0000664 0000000 0000000 00000000524 13340071377 0022031 0 ustar 00root root 0000000 0000000 {
"folders": [
{
"path": ".",
"file_exclude_patterns": ["*.sublime-workspace"],
"folder_exclude_patterns": ["dist"]
}
],
"build_systems": [
{
"name": "yarn test",
"cmd": ["yarn", "test"],
"file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)",
"working_dir": "$project_path"
}
]
}
d3-time-format-2.1.3/locale/ 0000775 0000000 0000000 00000000000 13340071377 0015511 5 ustar 00root root 0000000 0000000 d3-time-format-2.1.3/locale/ar-EG.json 0000664 0000000 0000000 00000001322 13340071377 0017275 0 ustar 00root root 0000000 0000000 {
"dateTime": "%x, %X",
"date": "%-d/%-m/%Y",
"time": "%-I:%M:%S %p",
"periods": ["ص", "م"],
"days": ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"],
"shortDays": ["أحد", "إثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
"months": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"],
"shortMonths": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"]
}
d3-time-format-2.1.3/locale/ca-ES.json 0000664 0000000 0000000 00000001012 13340071377 0017266 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e de %B de %Y, %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["diumenge", "dilluns", "dimarts", "dimecres", "dijous", "divendres", "dissabte"],
"shortDays": ["dg.", "dl.", "dt.", "dc.", "dj.", "dv.", "ds."],
"months": ["gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre"],
"shortMonths": ["gen.", "febr.", "març", "abr.", "maig", "juny", "jul.", "ag.", "set.", "oct.", "nov.", "des."]
}
d3-time-format-2.1.3/locale/cs-CZ.json 0000664 0000000 0000000 00000001015 13340071377 0017320 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A,%e.%B %Y, %X",
"date": "%-d.%-m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["neděle", "pondělí", "úterý", "středa", "čvrtek", "pátek", "sobota"],
"shortDays": ["ne.", "po.", "út.", "st.", "čt.", "pá.", "so."],
"months": ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"],
"shortMonths": ["led", "úno", "břez", "dub", "kvě", "čer", "červ", "srp", "zář", "říj", "list", "pros"]
}
d3-time-format-2.1.3/locale/da-DK.json 0000664 0000000 0000000 00000000765 13340071377 0017274 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A den %d %B %Y %X",
"date": "%d-%m-%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"],
"shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"],
"months": ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"],
"shortMonths": ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
}
d3-time-format-2.1.3/locale/de-CH.json 0000664 0000000 0000000 00000000766 13340071377 0017275 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, der %e. %B %Y, %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
"shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
"months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
"shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
}
d3-time-format-2.1.3/locale/de-DE.json 0000664 0000000 0000000 00000000766 13340071377 0017273 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, der %e. %B %Y, %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
"shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
"months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
"shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]
}
d3-time-format-2.1.3/locale/en-CA.json 0000664 0000000 0000000 00000000765 13340071377 0017277 0 ustar 00root root 0000000 0000000 {
"dateTime": "%a %b %e %X %Y",
"date": "%Y-%m-%d",
"time": "%H:%M:%S",
"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"]
}
d3-time-format-2.1.3/locale/en-GB.json 0000664 0000000 0000000 00000000765 13340071377 0017304 0 ustar 00root root 0000000 0000000 {
"dateTime": "%a %e %b %X %Y",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"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"]
}
d3-time-format-2.1.3/locale/en-US.json 0000664 0000000 0000000 00000000763 13340071377 0017341 0 ustar 00root root 0000000 0000000 {
"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"]
}
d3-time-format-2.1.3/locale/es-ES.json 0000664 0000000 0000000 00000001000 13340071377 0017307 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e de %B de %Y, %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"],
"shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
"months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"],
"shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"]
}
d3-time-format-2.1.3/locale/es-MX.json 0000664 0000000 0000000 00000000764 13340071377 0017344 0 ustar 00root root 0000000 0000000 {
"dateTime": "%x, %X",
"date": "%d/%m/%Y",
"time": "%-I:%M:%S %p",
"periods": ["AM", "PM"],
"days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"],
"shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
"months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"],
"shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"]
}
d3-time-format-2.1.3/locale/fi-FI.json 0000664 0000000 0000000 00000001063 13340071377 0017276 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %-d. %Bta %Y klo %X",
"date": "%-d.%-m.%Y",
"time": "%H:%M:%S",
"periods": ["a.m.", "p.m."],
"days": ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"],
"shortDays": ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"],
"months": ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
"shortMonths": ["Tammi", "Helmi", "Maalis", "Huhti", "Touko", "Kesä", "Heinä", "Elo", "Syys", "Loka", "Marras", "Joulu"]
}
d3-time-format-2.1.3/locale/fr-CA.json 0000664 0000000 0000000 00000000761 13340071377 0017300 0 ustar 00root root 0000000 0000000 {
"dateTime": "%a %e %b %Y %X",
"date": "%Y-%m-%d",
"time": "%H:%M:%S",
"periods": ["", ""],
"days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
"shortDays": ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"],
"months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
"shortMonths": ["jan", "fév", "mar", "avr", "mai", "jui", "jul", "aoû", "sep", "oct", "nov", "déc"]
}
d3-time-format-2.1.3/locale/fr-FR.json 0000664 0000000 0000000 00000001020 13340071377 0017311 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, le %e %B %Y, %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
"shortDays": ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
"months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
"shortMonths": ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."]
}
d3-time-format-2.1.3/locale/he-IL.json 0000664 0000000 0000000 00000001157 13340071377 0017306 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e ב%B %Y %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"],
"shortDays": ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"],
"months": ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"],
"shortMonths": ["ינו׳", "פבר׳", "מרץ", "אפר׳", "מאי", "יוני", "יולי", "אוג׳", "ספט׳", "אוק׳", "נוב׳", "דצמ׳"]
}
d3-time-format-2.1.3/locale/hu-HU.json 0000664 0000000 0000000 00000001036 13340071377 0017332 0 ustar 00root root 0000000 0000000 {
"dateTime": "%Y. %B %-e., %A %X",
"date": "%Y. %m. %d.",
"time": "%H:%M:%S",
"periods": ["de.", "du."],
"days": ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"],
"shortDays": ["V", "H", "K", "Sze", "Cs", "P", "Szo"],
"months": ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"],
"shortMonths": ["jan.", "feb.", "már.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."]
}
d3-time-format-2.1.3/locale/it-IT.json 0000664 0000000 0000000 00000001003 13340071377 0017324 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A %e %B %Y, %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"],
"shortDays": ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"],
"months": ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
"shortMonths": ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"]
}
d3-time-format-2.1.3/locale/ja-JP.json 0000664 0000000 0000000 00000001025 13340071377 0017303 0 ustar 00root root 0000000 0000000 {
"dateTime": "%Y %b %e %a %X",
"date": "%Y/%m/%d",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"],
"shortDays": ["日", "月", "火", "水", "木", "金", "土"],
"months": ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"],
"shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
}
d3-time-format-2.1.3/locale/ko-KR.json 0000664 0000000 0000000 00000001002 13340071377 0017320 0 ustar 00root root 0000000 0000000 {
"dateTime": "%Y/%m/%d %a %X",
"date": "%Y/%m/%d",
"time": "%H:%M:%S",
"periods": ["오전", "오후"],
"days": ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"],
"shortDays": ["일", "월", "화", "수", "목", "금", "토"],
"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월"]
}
d3-time-format-2.1.3/locale/mk-MK.json 0000664 0000000 0000000 00000001247 13340071377 0017324 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e %B %Y г. %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["недела", "понеделник", "вторник", "среда", "четврток", "петок", "сабота"],
"shortDays": ["нед", "пон", "вто", "сре", "чет", "пет", "саб"],
"months": ["јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"],
"shortMonths": ["јан", "фев", "мар", "апр", "мај", "јун", "јул", "авг", "сеп", "окт", "ное", "дек"]
}
d3-time-format-2.1.3/locale/nb-NO.json 0000664 0000000 0000000 00000000770 13340071377 0017321 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A den %d. %B %Y %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"],
"shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"],
"months": ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"],
"shortMonths": ["jan", "feb", "mars", "apr", "mai", "juni", "juli", "aug", "sep", "okt", "nov", "des"]
}
d3-time-format-2.1.3/locale/nl-NL.json 0000664 0000000 0000000 00000000762 13340071377 0017331 0 ustar 00root root 0000000 0000000 {
"dateTime": "%a %e %B %Y %T",
"date": "%d-%m-%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"],
"shortDays": ["zo", "ma", "di", "wo", "do", "vr", "za"],
"months": ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"],
"shortMonths": ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
}
d3-time-format-2.1.3/locale/pl-PL.json 0000664 0000000 0000000 00000001060 13340071377 0017325 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e %B %Y, %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"],
"shortDays": ["Niedz.", "Pon.", "Wt.", "Śr.", "Czw.", "Pt.", "Sob."],
"months": ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"],
"shortMonths": ["Stycz.", "Luty", "Marz.", "Kwie.", "Maj", "Czerw.", "Lipc.", "Sierp.", "Wrz.", "Paźdz.", "Listop.", "Grudz."]
}
d3-time-format-2.1.3/locale/pt-BR.json 0000664 0000000 0000000 00000000774 13340071377 0017340 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e de %B de %Y. %X",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"],
"shortDays": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"],
"months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
"shortMonths": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"]
}
d3-time-format-2.1.3/locale/ru-RU.json 0000664 0000000 0000000 00000001243 13340071377 0017356 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e %B %Y г. %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"],
"shortDays": ["вс", "пн", "вт", "ср", "чт", "пт", "сб"],
"months": ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"],
"shortMonths": ["янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"]
}
d3-time-format-2.1.3/locale/sv-SE.json 0000664 0000000 0000000 00000000770 13340071377 0017345 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A den %d %B %Y %X",
"date": "%Y-%m-%d",
"time": "%H:%M:%S",
"periods": ["fm", "em"],
"days": ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"],
"shortDays": ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"],
"months": ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"],
"shortMonths": ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
}
d3-time-format-2.1.3/locale/tr-TR.json 0000664 0000000 0000000 00000000764 13340071377 0017363 0 ustar 00root root 0000000 0000000 {
"dateTime": "%a %e %b %X %Y",
"date": "%d/%m/%Y",
"time": "%H:%M:%S",
"periods": ["AM", "PM"],
"days": ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"],
"shortDays": ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"],
"months": ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"],
"shortMonths": ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"]
}
d3-time-format-2.1.3/locale/uk-UA.json 0000664 0000000 0000000 00000001276 13340071377 0017334 0 ustar 00root root 0000000 0000000 {
"dateTime": "%A, %e %B %Y р. %X",
"date": "%d.%m.%Y",
"time": "%H:%M:%S",
"periods": ["дп", "пп"],
"days": ["неділя", "понеділок", "вівторок", "середа", "четвер", "п'ятниця", "субота"],
"shortDays": ["нд", "пн", "вт", "ср", "чт", "пт", "сб"],
"months": ["січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"],
"shortMonths": ["січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд."]
}
d3-time-format-2.1.3/locale/zh-CN.json 0000664 0000000 0000000 00000001120 13340071377 0017315 0 ustar 00root root 0000000 0000000 {
"dateTime": "%x %A %X",
"date": "%Y年%-m月%-d日",
"time": "%H:%M:%S",
"periods": ["上午", "下午"],
"days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
"shortDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
"months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"shortMonths": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
}
d3-time-format-2.1.3/package.json 0000664 0000000 0000000 00000003161 13340071377 0016541 0 ustar 00root root 0000000 0000000 {
"name": "d3-time-format",
"version": "2.1.3",
"description": "A JavaScript time formatter and parser inspired by strftime and strptime.",
"keywords": [
"d3",
"d3-module",
"time",
"format",
"strftime",
"strptime"
],
"homepage": "https://d3js.org/d3-time-format/",
"license": "BSD-3-Clause",
"author": {
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"main": "dist/d3-time-format.js",
"unpkg": "dist/d3-time-format.min.js",
"jsdelivr": "dist/d3-time-format.min.js",
"module": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-time-format.git"
},
"scripts": {
"pretest": "rollup -c",
"test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src",
"prepublishOnly": "rm -rf dist && yarn test",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
},
"dependencies": {
"d3-time": "1"
},
"devDependencies": {
"d3-queue": "3",
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"tape": "4"
}
}
d3-time-format-2.1.3/rollup.config.js 0000664 0000000 0000000 00000001545 13340071377 0017376 0 ustar 00root root 0000000 0000000 import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";
const config = {
input: "src/index.js",
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
output: {
file: `dist/${meta.name}.js`,
name: "d3",
format: "umd",
indent: false,
extend: true,
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
},
plugins: []
};
export default [
config,
{
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
},
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
];
d3-time-format-2.1.3/src/ 0000775 0000000 0000000 00000000000 13340071377 0015041 5 ustar 00root root 0000000 0000000 d3-time-format-2.1.3/src/defaultLocale.js 0000664 0000000 0000000 00000001543 13340071377 0020146 0 ustar 00root root 0000000 0000000 import formatLocale from "./locale";
var locale;
export var timeFormat;
export var timeParse;
export var utcFormat;
export var utcParse;
defaultLocale({
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"]
});
export default function defaultLocale(definition) {
locale = formatLocale(definition);
timeFormat = locale.format;
timeParse = locale.parse;
utcFormat = locale.utcFormat;
utcParse = locale.utcParse;
return locale;
}
d3-time-format-2.1.3/src/index.js 0000664 0000000 0000000 00000000410 13340071377 0016501 0 ustar 00root root 0000000 0000000 export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from "./defaultLocale";
export {default as timeFormatLocale} from "./locale";
export {default as isoFormat} from "./isoFormat";
export {default as isoParse} from "./isoParse";
d3-time-format-2.1.3/src/isoFormat.js 0000664 0000000 0000000 00000000434 13340071377 0017343 0 ustar 00root root 0000000 0000000 import {utcFormat} from "./defaultLocale";
export var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ";
function formatIsoNative(date) {
return date.toISOString();
}
var formatIso = Date.prototype.toISOString
? formatIsoNative
: utcFormat(isoSpecifier);
export default formatIso;
d3-time-format-2.1.3/src/isoParse.js 0000664 0000000 0000000 00000000477 13340071377 0017174 0 ustar 00root root 0000000 0000000 import {isoSpecifier} from "./isoFormat";
import {utcParse} from "./defaultLocale";
function parseIsoNative(string) {
var date = new Date(string);
return isNaN(date) ? null : date;
}
var parseIso = +new Date("2000-01-01T00:00:00.000Z")
? parseIsoNative
: utcParse(isoSpecifier);
export default parseIso;
d3-time-format-2.1.3/src/locale.js 0000664 0000000 0000000 00000041275 13340071377 0016647 0 ustar 00root root 0000000 0000000 import {
timeDay,
timeSunday,
timeMonday,
timeThursday,
timeYear,
utcDay,
utcSunday,
utcMonday,
utcThursday,
utcYear
} from "d3-time";
function localDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
date.setFullYear(d.y);
return date;
}
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
}
function utcDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
date.setUTCFullYear(d.y);
return date;
}
return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
}
function newYear(y) {
return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};
}
export default function formatLocale(locale) {
var locale_dateTime = locale.dateTime,
locale_date = locale.date,
locale_time = locale.time,
locale_periods = locale.periods,
locale_weekdays = locale.days,
locale_shortWeekdays = locale.shortDays,
locale_months = locale.months,
locale_shortMonths = locale.shortMonths;
var periodRe = formatRe(locale_periods),
periodLookup = formatLookup(locale_periods),
weekdayRe = formatRe(locale_weekdays),
weekdayLookup = formatLookup(locale_weekdays),
shortWeekdayRe = formatRe(locale_shortWeekdays),
shortWeekdayLookup = formatLookup(locale_shortWeekdays),
monthRe = formatRe(locale_months),
monthLookup = formatLookup(locale_months),
shortMonthRe = formatRe(locale_shortMonths),
shortMonthLookup = formatLookup(locale_shortMonths);
var formats = {
"a": formatShortWeekday,
"A": formatWeekday,
"b": formatShortMonth,
"B": formatMonth,
"c": null,
"d": formatDayOfMonth,
"e": formatDayOfMonth,
"f": formatMicroseconds,
"H": formatHour24,
"I": formatHour12,
"j": formatDayOfYear,
"L": formatMilliseconds,
"m": formatMonthNumber,
"M": formatMinutes,
"p": formatPeriod,
"Q": formatUnixTimestamp,
"s": formatUnixTimestampSeconds,
"S": formatSeconds,
"u": formatWeekdayNumberMonday,
"U": formatWeekNumberSunday,
"V": formatWeekNumberISO,
"w": formatWeekdayNumberSunday,
"W": formatWeekNumberMonday,
"x": null,
"X": null,
"y": formatYear,
"Y": formatFullYear,
"Z": formatZone,
"%": formatLiteralPercent
};
var utcFormats = {
"a": formatUTCShortWeekday,
"A": formatUTCWeekday,
"b": formatUTCShortMonth,
"B": formatUTCMonth,
"c": null,
"d": formatUTCDayOfMonth,
"e": formatUTCDayOfMonth,
"f": formatUTCMicroseconds,
"H": formatUTCHour24,
"I": formatUTCHour12,
"j": formatUTCDayOfYear,
"L": formatUTCMilliseconds,
"m": formatUTCMonthNumber,
"M": formatUTCMinutes,
"p": formatUTCPeriod,
"Q": formatUnixTimestamp,
"s": formatUnixTimestampSeconds,
"S": formatUTCSeconds,
"u": formatUTCWeekdayNumberMonday,
"U": formatUTCWeekNumberSunday,
"V": formatUTCWeekNumberISO,
"w": formatUTCWeekdayNumberSunday,
"W": formatUTCWeekNumberMonday,
"x": null,
"X": null,
"y": formatUTCYear,
"Y": formatUTCFullYear,
"Z": formatUTCZone,
"%": formatLiteralPercent
};
var parses = {
"a": parseShortWeekday,
"A": parseWeekday,
"b": parseShortMonth,
"B": parseMonth,
"c": parseLocaleDateTime,
"d": parseDayOfMonth,
"e": parseDayOfMonth,
"f": parseMicroseconds,
"H": parseHour24,
"I": parseHour24,
"j": parseDayOfYear,
"L": parseMilliseconds,
"m": parseMonthNumber,
"M": parseMinutes,
"p": parsePeriod,
"Q": parseUnixTimestamp,
"s": parseUnixTimestampSeconds,
"S": parseSeconds,
"u": parseWeekdayNumberMonday,
"U": parseWeekNumberSunday,
"V": parseWeekNumberISO,
"w": parseWeekdayNumberSunday,
"W": parseWeekNumberMonday,
"x": parseLocaleDate,
"X": parseLocaleTime,
"y": parseYear,
"Y": parseFullYear,
"Z": parseZone,
"%": parseLiteralPercent
};
// These recursive directive definitions must be deferred.
formats.x = newFormat(locale_date, formats);
formats.X = newFormat(locale_time, formats);
formats.c = newFormat(locale_dateTime, formats);
utcFormats.x = newFormat(locale_date, utcFormats);
utcFormats.X = newFormat(locale_time, utcFormats);
utcFormats.c = newFormat(locale_dateTime, utcFormats);
function newFormat(specifier, formats) {
return function(date) {
var string = [],
i = -1,
j = 0,
n = specifier.length,
c,
pad,
format;
if (!(date instanceof Date)) date = new Date(+date);
while (++i < n) {
if (specifier.charCodeAt(i) === 37) {
string.push(specifier.slice(j, i));
if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);
else pad = c === "e" ? " " : "0";
if (format = formats[c]) c = format(date, pad);
string.push(c);
j = i + 1;
}
}
string.push(specifier.slice(j, i));
return string.join("");
};
}
function newParse(specifier, newDate) {
return function(string) {
var d = newYear(1900),
i = parseSpecifier(d, specifier, string += "", 0),
week, day;
if (i != string.length) return null;
// If a UNIX timestamp is specified, return it.
if ("Q" in d) return new Date(d.Q);
// The am-pm flag is 0 for AM, and 1 for PM.
if ("p" in d) d.H = d.H % 12 + d.p * 12;
// Convert day-of-week and week-of-year to day-of-year.
if ("V" in d) {
if (d.V < 1 || d.V > 53) return null;
if (!("w" in d)) d.w = 1;
if ("Z" in d) {
week = utcDate(newYear(d.y)), day = week.getUTCDay();
week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
week = utcDay.offset(week, (d.V - 1) * 7);
d.y = week.getUTCFullYear();
d.m = week.getUTCMonth();
d.d = week.getUTCDate() + (d.w + 6) % 7;
} else {
week = newDate(newYear(d.y)), day = week.getDay();
week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
week = timeDay.offset(week, (d.V - 1) * 7);
d.y = week.getFullYear();
d.m = week.getMonth();
d.d = week.getDate() + (d.w + 6) % 7;
}
} else if ("W" in d || "U" in d) {
if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
day = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();
d.m = 0;
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
}
// If a time zone is specified, all fields are interpreted as UTC and then
// offset according to the specified time zone.
if ("Z" in d) {
d.H += d.Z / 100 | 0;
d.M += d.Z % 100;
return utcDate(d);
}
// Otherwise, all fields are in local time.
return newDate(d);
};
}
function parseSpecifier(d, specifier, string, j) {
var i = 0,
n = specifier.length,
m = string.length,
c,
parse;
while (i < n) {
if (j >= m) return -1;
c = specifier.charCodeAt(i++);
if (c === 37) {
c = specifier.charAt(i++);
parse = parses[c in pads ? specifier.charAt(i++) : c];
if (!parse || ((j = parse(d, string, j)) < 0)) return -1;
} else if (c != string.charCodeAt(j++)) {
return -1;
}
}
return j;
}
function parsePeriod(d, string, i) {
var n = periodRe.exec(string.slice(i));
return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseShortWeekday(d, string, i) {
var n = shortWeekdayRe.exec(string.slice(i));
return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseWeekday(d, string, i) {
var n = weekdayRe.exec(string.slice(i));
return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseShortMonth(d, string, i) {
var n = shortMonthRe.exec(string.slice(i));
return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseMonth(d, string, i) {
var n = monthRe.exec(string.slice(i));
return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
}
function parseLocaleDateTime(d, string, i) {
return parseSpecifier(d, locale_dateTime, string, i);
}
function parseLocaleDate(d, string, i) {
return parseSpecifier(d, locale_date, string, i);
}
function parseLocaleTime(d, string, i) {
return parseSpecifier(d, locale_time, string, i);
}
function formatShortWeekday(d) {
return locale_shortWeekdays[d.getDay()];
}
function formatWeekday(d) {
return locale_weekdays[d.getDay()];
}
function formatShortMonth(d) {
return locale_shortMonths[d.getMonth()];
}
function formatMonth(d) {
return locale_months[d.getMonth()];
}
function formatPeriod(d) {
return locale_periods[+(d.getHours() >= 12)];
}
function formatUTCShortWeekday(d) {
return locale_shortWeekdays[d.getUTCDay()];
}
function formatUTCWeekday(d) {
return locale_weekdays[d.getUTCDay()];
}
function formatUTCShortMonth(d) {
return locale_shortMonths[d.getUTCMonth()];
}
function formatUTCMonth(d) {
return locale_months[d.getUTCMonth()];
}
function formatUTCPeriod(d) {
return locale_periods[+(d.getUTCHours() >= 12)];
}
return {
format: function(specifier) {
var f = newFormat(specifier += "", formats);
f.toString = function() { return specifier; };
return f;
},
parse: function(specifier) {
var p = newParse(specifier += "", localDate);
p.toString = function() { return specifier; };
return p;
},
utcFormat: function(specifier) {
var f = newFormat(specifier += "", utcFormats);
f.toString = function() { return specifier; };
return f;
},
utcParse: function(specifier) {
var p = newParse(specifier, utcDate);
p.toString = function() { return specifier; };
return p;
}
};
}
var pads = {"-": "", "_": " ", "0": "0"},
numberRe = /^\s*\d+/, // note: ignores next directive
percentRe = /^%/,
requoteRe = /[\\^$*+?|[\]().{}]/g;
function pad(value, fill, width) {
var sign = value < 0 ? "-" : "",
string = (sign ? -value : value) + "",
length = string.length;
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}
function requote(s) {
return s.replace(requoteRe, "\\$&");
}
function formatRe(names) {
return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
}
function formatLookup(names) {
var map = {}, i = -1, n = names.length;
while (++i < n) map[names[i].toLowerCase()] = i;
return map;
}
function parseWeekdayNumberSunday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 1));
return n ? (d.w = +n[0], i + n[0].length) : -1;
}
function parseWeekdayNumberMonday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 1));
return n ? (d.u = +n[0], i + n[0].length) : -1;
}
function parseWeekNumberSunday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.U = +n[0], i + n[0].length) : -1;
}
function parseWeekNumberISO(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.V = +n[0], i + n[0].length) : -1;
}
function parseWeekNumberMonday(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.W = +n[0], i + n[0].length) : -1;
}
function parseFullYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 4));
return n ? (d.y = +n[0], i + n[0].length) : -1;
}
function parseYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;
}
function parseZone(d, string, i) {
var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
}
function parseMonthNumber(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
}
function parseDayOfMonth(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.d = +n[0], i + n[0].length) : -1;
}
function parseDayOfYear(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 3));
return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
}
function parseHour24(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.H = +n[0], i + n[0].length) : -1;
}
function parseMinutes(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.M = +n[0], i + n[0].length) : -1;
}
function parseSeconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 2));
return n ? (d.S = +n[0], i + n[0].length) : -1;
}
function parseMilliseconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 3));
return n ? (d.L = +n[0], i + n[0].length) : -1;
}
function parseMicroseconds(d, string, i) {
var n = numberRe.exec(string.slice(i, i + 6));
return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;
}
function parseLiteralPercent(d, string, i) {
var n = percentRe.exec(string.slice(i, i + 1));
return n ? i + n[0].length : -1;
}
function parseUnixTimestamp(d, string, i) {
var n = numberRe.exec(string.slice(i));
return n ? (d.Q = +n[0], i + n[0].length) : -1;
}
function parseUnixTimestampSeconds(d, string, i) {
var n = numberRe.exec(string.slice(i));
return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1;
}
function formatDayOfMonth(d, p) {
return pad(d.getDate(), p, 2);
}
function formatHour24(d, p) {
return pad(d.getHours(), p, 2);
}
function formatHour12(d, p) {
return pad(d.getHours() % 12 || 12, p, 2);
}
function formatDayOfYear(d, p) {
return pad(1 + timeDay.count(timeYear(d), d), p, 3);
}
function formatMilliseconds(d, p) {
return pad(d.getMilliseconds(), p, 3);
}
function formatMicroseconds(d, p) {
return formatMilliseconds(d, p) + "000";
}
function formatMonthNumber(d, p) {
return pad(d.getMonth() + 1, p, 2);
}
function formatMinutes(d, p) {
return pad(d.getMinutes(), p, 2);
}
function formatSeconds(d, p) {
return pad(d.getSeconds(), p, 2);
}
function formatWeekdayNumberMonday(d) {
var day = d.getDay();
return day === 0 ? 7 : day;
}
function formatWeekNumberSunday(d, p) {
return pad(timeSunday.count(timeYear(d), d), p, 2);
}
function formatWeekNumberISO(d, p) {
var day = d.getDay();
d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);
return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
}
function formatWeekdayNumberSunday(d) {
return d.getDay();
}
function formatWeekNumberMonday(d, p) {
return pad(timeMonday.count(timeYear(d), d), p, 2);
}
function formatYear(d, p) {
return pad(d.getFullYear() % 100, p, 2);
}
function formatFullYear(d, p) {
return pad(d.getFullYear() % 10000, p, 4);
}
function formatZone(d) {
var z = d.getTimezoneOffset();
return (z > 0 ? "-" : (z *= -1, "+"))
+ pad(z / 60 | 0, "0", 2)
+ pad(z % 60, "0", 2);
}
function formatUTCDayOfMonth(d, p) {
return pad(d.getUTCDate(), p, 2);
}
function formatUTCHour24(d, p) {
return pad(d.getUTCHours(), p, 2);
}
function formatUTCHour12(d, p) {
return pad(d.getUTCHours() % 12 || 12, p, 2);
}
function formatUTCDayOfYear(d, p) {
return pad(1 + utcDay.count(utcYear(d), d), p, 3);
}
function formatUTCMilliseconds(d, p) {
return pad(d.getUTCMilliseconds(), p, 3);
}
function formatUTCMicroseconds(d, p) {
return formatUTCMilliseconds(d, p) + "000";
}
function formatUTCMonthNumber(d, p) {
return pad(d.getUTCMonth() + 1, p, 2);
}
function formatUTCMinutes(d, p) {
return pad(d.getUTCMinutes(), p, 2);
}
function formatUTCSeconds(d, p) {
return pad(d.getUTCSeconds(), p, 2);
}
function formatUTCWeekdayNumberMonday(d) {
var dow = d.getUTCDay();
return dow === 0 ? 7 : dow;
}
function formatUTCWeekNumberSunday(d, p) {
return pad(utcSunday.count(utcYear(d), d), p, 2);
}
function formatUTCWeekNumberISO(d, p) {
var day = d.getUTCDay();
d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
}
function formatUTCWeekdayNumberSunday(d) {
return d.getUTCDay();
}
function formatUTCWeekNumberMonday(d, p) {
return pad(utcMonday.count(utcYear(d), d), p, 2);
}
function formatUTCYear(d, p) {
return pad(d.getUTCFullYear() % 100, p, 2);
}
function formatUTCFullYear(d, p) {
return pad(d.getUTCFullYear() % 10000, p, 4);
}
function formatUTCZone() {
return "+0000";
}
function formatLiteralPercent() {
return "%";
}
function formatUnixTimestamp(d) {
return +d;
}
function formatUnixTimestampSeconds(d) {
return Math.floor(+d / 1000);
}
d3-time-format-2.1.3/test/ 0000775 0000000 0000000 00000000000 13340071377 0015231 5 ustar 00root root 0000000 0000000 d3-time-format-2.1.3/test/date.js 0000664 0000000 0000000 00000002200 13340071377 0016476 0 ustar 00root root 0000000 0000000 exports.local = function(year, month, day, hours, minutes, seconds, milliseconds) {
if (year == null) year = 0;
if (month == null) month = 0;
if (day == null) day = 1;
if (hours == null) hours = 0;
if (minutes == null) minutes = 0;
if (seconds == null) seconds = 0;
if (milliseconds == null) milliseconds = 0;
if (0 <= year && year < 100) {
var date = new Date(-1, month, day, hours, minutes, seconds, milliseconds);
date.setFullYear(year);
return date;
}
return new Date(year, month, day, hours, minutes, seconds, milliseconds);
};
exports.utc = function(year, month, day, hours, minutes, seconds, milliseconds) {
if (year == null) year = 0;
if (month == null) month = 0;
if (day == null) day = 1;
if (hours == null) hours = 0;
if (minutes == null) minutes = 0;
if (seconds == null) seconds = 0;
if (milliseconds == null) milliseconds = 0;
if (0 <= year && year < 100) {
var date = new Date(Date.UTC(-1, month, day, hours, minutes, seconds, milliseconds));
date.setUTCFullYear(year);
return date;
}
return new Date(Date.UTC(year, month, day, hours, minutes, seconds, milliseconds));
};
d3-time-format-2.1.3/test/defaultLocale-test.js 0000664 0000000 0000000 00000005103 13340071377 0021307 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
d3 = require("../"),
enUs = require("../locale/en-US"),
frFr = require("../locale/fr-FR");
tape("d3.timeFormat(specifier) defaults to en-US", function(test) {
test.equal(d3.timeFormat("%c")(new Date(2000, 0, 1)), "1/1/2000, 12:00:00 AM");
test.end();
});
tape("d3.timeParse(specifier) defaults to en-US", function(test) {
test.equal(+d3.timeParse("%c")("1/1/2000, 12:00:00 AM"), +new Date(2000, 0, 1));
test.end();
});
tape("d3.utcFormat(specifier) defaults to en-US", function(test) {
test.equal(d3.utcFormat("%c")(new Date(Date.UTC(2000, 0, 1))), "1/1/2000, 12:00:00 AM");
test.end();
});
tape("d3.utcParse(specifier) defaults to en-US", function(test) {
test.equal(+d3.utcParse("%c")("1/1/2000, 12:00:00 AM"), +new Date(Date.UTC(2000, 0, 1)));
test.end();
});
tape("d3.timeFormatDefaultLocale(definition) returns the new default locale", function(test) {
var locale = d3.timeFormatDefaultLocale(frFr);
try {
test.equal(locale.format("%c")(new Date(2000, 0, 1)), "samedi, le 1 janvier 2000, 00:00:00");
test.end();
} finally {
d3.timeFormatDefaultLocale(enUs);
}
});
tape("d3.timeFormatDefaultLocale(definition) affects d3.timeFormat", function(test) {
var locale = d3.timeFormatDefaultLocale(frFr);
try {
test.equal(d3.timeFormat, locale.format);
test.equal(d3.timeFormat("%c")(new Date(2000, 0, 1)), "samedi, le 1 janvier 2000, 00:00:00");
test.end();
} finally {
d3.timeFormatDefaultLocale(enUs);
}
});
tape("d3.timeFormatDefaultLocale(definition) affects d3.timeParse", function(test) {
var locale = d3.timeFormatDefaultLocale(frFr);
try {
test.equal(d3.timeParse, locale.parse);
test.equal(+d3.timeParse("%c")("samedi, le 1 janvier 2000, 00:00:00"), +new Date(2000, 0, 1));
test.end();
} finally {
d3.timeFormatDefaultLocale(enUs);
}
});
tape("d3.timeFormatDefaultLocale(definition) affects d3.utcFormat", function(test) {
var locale = d3.timeFormatDefaultLocale(frFr);
try {
test.equal(d3.utcFormat, locale.utcFormat);
test.equal(d3.utcFormat("%c")(new Date(Date.UTC(2000, 0, 1))), "samedi, le 1 janvier 2000, 00:00:00");
test.end();
} finally {
d3.timeFormatDefaultLocale(enUs);
}
});
tape("d3.timeFormatDefaultLocale(definition) affects d3.utcParse", function(test) {
var locale = d3.timeFormatDefaultLocale(frFr);
try {
test.equal(d3.utcParse, locale.utcParse);
test.equal(+d3.utcParse("%c")("samedi, le 1 janvier 2000, 00:00:00"), +new Date(Date.UTC(2000, 0, 1)));
test.end();
} finally {
d3.timeFormatDefaultLocale(enUs);
}
});
d3-time-format-2.1.3/test/format-test.js 0000664 0000000 0000000 00000026363 13340071377 0020046 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
time = require("d3-time"),
timeFormat = require("../"),
date = require("./date");
var formatMillisecond = timeFormat.timeFormat(".%L"),
formatSecond = timeFormat.timeFormat(":%S"),
formatMinute = timeFormat.timeFormat("%I:%M"),
formatHour = timeFormat.timeFormat("%I %p"),
formatDay = timeFormat.timeFormat("%a %d"),
formatWeek = timeFormat.timeFormat("%b %d"),
formatMonth = timeFormat.timeFormat("%B"),
formatYear = timeFormat.timeFormat("%Y");
function multi(d) {
return (time.timeSecond(d) < d ? formatMillisecond
: time.timeMinute(d) < d ? formatSecond
: time.timeHour(d) < d ? formatMinute
: time.timeDay(d) < d ? formatHour
: time.timeMonth(d) < d ? (time.timeWeek(d) < d ? formatDay : formatWeek)
: time.timeYear(d) < d ? formatMonth
: formatYear)(d);
}
tape("timeFormat(date) coerces the specified date to a Date", function(test) {
var f = timeFormat.timeFormat("%c");
test.equal(f(+date.local(1990, 0, 1)), "1/1/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 2)), "1/2/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 3)), "1/3/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 4)), "1/4/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 5)), "1/5/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 6)), "1/6/1990, 12:00:00 AM");
test.equal(f(+date.local(1990, 0, 7)), "1/7/1990, 12:00:00 AM");
test.end();
});
tape("timeFormat(\"%a\")(date) formats abbreviated weekdays", function(test) {
var f = timeFormat.timeFormat("%a");
test.equal(f(date.local(1990, 0, 1)), "Mon");
test.equal(f(date.local(1990, 0, 2)), "Tue");
test.equal(f(date.local(1990, 0, 3)), "Wed");
test.equal(f(date.local(1990, 0, 4)), "Thu");
test.equal(f(date.local(1990, 0, 5)), "Fri");
test.equal(f(date.local(1990, 0, 6)), "Sat");
test.equal(f(date.local(1990, 0, 7)), "Sun");
test.end();
});
tape("timeFormat(\"%A\")(date) formats weekdays", function(test) {
var f = timeFormat.timeFormat("%A");
test.equal(f(date.local(1990, 0, 1)), "Monday");
test.equal(f(date.local(1990, 0, 2)), "Tuesday");
test.equal(f(date.local(1990, 0, 3)), "Wednesday");
test.equal(f(date.local(1990, 0, 4)), "Thursday");
test.equal(f(date.local(1990, 0, 5)), "Friday");
test.equal(f(date.local(1990, 0, 6)), "Saturday");
test.equal(f(date.local(1990, 0, 7)), "Sunday");
test.end();
});
tape("timeFormat(\"%b\")(date) formats abbreviated months", function(test) {
var f = timeFormat.timeFormat("%b");
test.equal(f(date.local(1990, 0, 1)), "Jan");
test.equal(f(date.local(1990, 1, 1)), "Feb");
test.equal(f(date.local(1990, 2, 1)), "Mar");
test.equal(f(date.local(1990, 3, 1)), "Apr");
test.equal(f(date.local(1990, 4, 1)), "May");
test.equal(f(date.local(1990, 5, 1)), "Jun");
test.equal(f(date.local(1990, 6, 1)), "Jul");
test.equal(f(date.local(1990, 7, 1)), "Aug");
test.equal(f(date.local(1990, 8, 1)), "Sep");
test.equal(f(date.local(1990, 9, 1)), "Oct");
test.equal(f(date.local(1990, 10, 1)), "Nov");
test.equal(f(date.local(1990, 11, 1)), "Dec");
test.end();
});
tape("timeFormat(\"%B\")(date) formats months", function(test) {
var f = timeFormat.timeFormat("%B");
test.equal(f(date.local(1990, 0, 1)), "January");
test.equal(f(date.local(1990, 1, 1)), "February");
test.equal(f(date.local(1990, 2, 1)), "March");
test.equal(f(date.local(1990, 3, 1)), "April");
test.equal(f(date.local(1990, 4, 1)), "May");
test.equal(f(date.local(1990, 5, 1)), "June");
test.equal(f(date.local(1990, 6, 1)), "July");
test.equal(f(date.local(1990, 7, 1)), "August");
test.equal(f(date.local(1990, 8, 1)), "September");
test.equal(f(date.local(1990, 9, 1)), "October");
test.equal(f(date.local(1990, 10, 1)), "November");
test.equal(f(date.local(1990, 11, 1)), "December");
test.end();
});
tape("timeFormat(\"%c\")(date) formats localized dates and times", function(test) {
var f = timeFormat.timeFormat("%c");
test.equal(f(date.local(1990, 0, 1)), "1/1/1990, 12:00:00 AM");
test.end();
});
tape("timeFormat(\"%d\")(date) formats zero-padded dates", function(test) {
var f = timeFormat.timeFormat("%d");
test.equal(f(date.local(1990, 0, 1)), "01");
test.end();
});
tape("timeFormat(\"%e\")(date) formats space-padded dates", function(test) {
var f = timeFormat.timeFormat("%e");
test.equal(f(date.local(1990, 0, 1)), " 1");
test.end();
});
tape("timeFormat(\"%H\")(date) formats zero-padded hours (24)", function(test) {
var f = timeFormat.timeFormat("%H");
test.equal(f(date.local(1990, 0, 1, 0)), "00");
test.equal(f(date.local(1990, 0, 1, 13)), "13");
test.end();
});
tape("timeFormat(\"%I\")(date) formats zero-padded hours (12)", function(test) {
var f = timeFormat.timeFormat("%I");
test.equal(f(date.local(1990, 0, 1, 0)), "12");
test.equal(f(date.local(1990, 0, 1, 13)), "01");
test.end();
});
tape("timeFormat(\"%j\")(date) formats zero-padded day of year numbers", function(test) {
var f = timeFormat.timeFormat("%j");
test.equal(f(date.local(1990, 0, 1)), "001");
test.equal(f(date.local(1990, 5, 1)), "152");
test.equal(f(date.local(2010, 2, 13)), "072");
test.equal(f(date.local(2010, 2, 14)), "073"); // DST begins
test.equal(f(date.local(2010, 2, 15)), "074");
test.equal(f(date.local(2010, 10, 6)), "310");
test.equal(f(date.local(2010, 10, 7)), "311"); // DST ends
test.equal(f(date.local(2010, 10, 8)), "312");
test.end();
});
tape("timeFormat(\"%m\")(date) formats zero-padded months", function(test) {
var f = timeFormat.timeFormat("%m");
test.equal(f(date.local(1990, 0, 1)), "01");
test.equal(f(date.local(1990, 9, 1)), "10");
test.end();
});
tape("timeFormat(\"%M\")(date) formats zero-padded minutes", function(test) {
var f = timeFormat.timeFormat("%M");
test.equal(f(date.local(1990, 0, 1, 0, 0)), "00");
test.equal(f(date.local(1990, 0, 1, 0, 32)), "32");
test.end();
});
tape("timeFormat(\"%p\")(date) formats AM or PM", function(test) {
var f = timeFormat.timeFormat("%p");
test.equal(f(date.local(1990, 0, 1, 0)), "AM");
test.equal(f(date.local(1990, 0, 1, 13)), "PM");
test.end();
});
tape("timeFormat(\"%S\")(date) formats zero-padded seconds", function(test) {
var f = timeFormat.timeFormat("%S");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0)), "00");
test.equal(f(date.local(1990, 0, 1, 0, 0, 32)), "32");
var f = timeFormat.timeFormat("%0S");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0)), "00");
test.equal(f(date.local(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("timeFormat(\"%_S\")(date) formats space-padded seconds", function(test) {
var f = timeFormat.timeFormat("%_S");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0)), " 0");
test.equal(f(date.local(1990, 0, 1, 0, 0, 3)), " 3");
test.equal(f(date.local(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("timeFormat(\"-S\")(date) formats no-padded seconds", function(test) {
var f = timeFormat.timeFormat("%-S");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0)), "0");
test.equal(f(date.local(1990, 0, 1, 0, 0, 3)), "3");
test.equal(f(date.local(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("timeFormat(\"%L\")(date) formats zero-padded milliseconds", function(test) {
var f = timeFormat.timeFormat("%L");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0, 0)), "000");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0, 432)), "432");
test.end();
});
tape("timeFormat(\"%u\")(date) formats week day numbers", function(test) {
var f = timeFormat.timeFormat("%u");
test.equal(f(date.local(1990, 0, 1, 0)), "1");
test.equal(f(date.local(1990, 0, 7, 0)), "7");
test.equal(f(date.local(2010, 2, 13, 23)), "6");
test.end();
});
tape("timeFormat(\"%f\")(date) formats zero-padded microseconds", function(test) {
var f = timeFormat.timeFormat("%f");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0, 0)), "000000");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0, 432)), "432000");
test.end();
});
tape("timeFormat(\"%U\")(date) formats zero-padded week numbers", function(test) {
var f = timeFormat.timeFormat("%U");
test.equal(f(date.local(1990, 0, 1, 0)), "00");
test.equal(f(date.local(1990, 5, 1, 0)), "21");
test.equal(f(date.local(2010, 2, 13, 23)), "10");
test.equal(f(date.local(2010, 2, 14, 0)), "11"); // DST begins
test.equal(f(date.local(2010, 2, 15, 0)), "11");
test.equal(f(date.local(2010, 10, 6, 23)), "44");
test.equal(f(date.local(2010, 10, 7, 0)), "45"); // DST ends
test.equal(f(date.local(2010, 10, 8, 0)), "45");
test.end();
});
tape("timeFormat(\"%V\")(date) formats zero-padded ISO 8601 week numbers", function(test) {
var f = timeFormat.timeFormat("%V");
test.equal(f(date.local(1990, 0, 1, 0)), "01");
test.equal(f(date.local(1990, 5, 1, 0)), "22");
test.equal(f(date.local(2010, 2, 13, 23)), "10");
test.equal(f(date.local(2010, 2, 14, 0)), "10"); // DST begins
test.equal(f(date.local(2010, 2, 15, 0)), "11");
test.equal(f(date.local(2010, 10, 6, 23)), "44");
test.equal(f(date.local(2010, 10, 7, 0)), "44"); // DST ends
test.equal(f(date.local(2010, 10, 8, 0)), "45");
test.equal(f(date.local(2015, 11, 31, 0)), "53");
test.equal(f(date.local(2016, 0, 1, 0)), "53");
test.end();
});
tape("timeFormat(\"%x\")(date) formats localized dates", function(test) {
var f = timeFormat.timeFormat("%x");
test.equal(f(date.local(1990, 0, 1)), "1/1/1990");
test.equal(f(date.local(2010, 5, 1)), "6/1/2010");
test.end();
});
tape("timeFormat(\"%X\")(date) formats localized times", function(test) {
var f = timeFormat.timeFormat("%X");
test.equal(f(date.local(1990, 0, 1, 0, 0, 0)), "12:00:00 AM");
test.equal(f(date.local(1990, 0, 1, 13, 34, 59)), "1:34:59 PM");
test.end();
});
tape("timeFormat(\"%y\")(date) formats zero-padded two-digit years", function(test) {
var f = timeFormat.timeFormat("%y");
test.equal(f(date.local(+1990, 0, 1)), "90");
test.equal(f(date.local(+2002, 0, 1)), "02");
test.equal(f(date.local(-0002, 0, 1)), "-02");
test.end();
});
tape("timeFormat(\"%Y\")(date) formats zero-padded four-digit years", function(test) {
var f = timeFormat.timeFormat("%Y");
test.equal(f(date.local( 123, 0, 1)), "0123");
test.equal(f(date.local( 1990, 0, 1)), "1990");
test.equal(f(date.local( 2002, 0, 1)), "2002");
test.equal(f(date.local(10002, 0, 1)), "0002");
test.equal(f(date.local( -2, 0, 1)), "-0002");
test.end();
});
tape("timeFormat(\"%Z\")(date) formats time zones", function(test) {
var f = timeFormat.timeFormat("%Z");
test.equal(f(date.local(1990, 0, 1)), "-0800");
test.end();
});
tape("timeFormat(\"%%\")(date) formats literal percent signs", function(test) {
var f = timeFormat.timeFormat("%%");
test.equal(f(date.local(1990, 0, 1)), "%");
test.end();
});
tape("timeFormat(…) can be used to create a conditional multi-format", function(test) {
test.equal(multi(date.local(1990, 0, 1, 0, 0, 0, 12)), ".012");
test.equal(multi(date.local(1990, 0, 1, 0, 0, 1, 0)), ":01");
test.equal(multi(date.local(1990, 0, 1, 0, 1, 0, 0)), "12:01");
test.equal(multi(date.local(1990, 0, 1, 1, 0, 0, 0)), "01 AM");
test.equal(multi(date.local(1990, 0, 2, 0, 0, 0, 0)), "Tue 02");
test.equal(multi(date.local(1990, 1, 1, 0, 0, 0, 0)), "February");
test.equal(multi(date.local(1990, 0, 1, 0, 0, 0, 0)), "1990");
test.end();
});
d3-time-format-2.1.3/test/isoFormat-test.js 0000664 0000000 0000000 00000000571 13340071377 0020512 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
timeFormat = require("../"),
date = require("./date");
tape("isoFormat(date) returns an ISO 8601 UTC string", function(test) {
test.equal(timeFormat.isoFormat(date.utc(1990, 0, 1, 0, 0, 0)), "1990-01-01T00:00:00.000Z");
test.equal(timeFormat.isoFormat(date.utc(2011, 11, 31, 23, 59, 59)), "2011-12-31T23:59:59.000Z");
test.end();
});
d3-time-format-2.1.3/test/isoParse-test.js 0000664 0000000 0000000 00000000652 13340071377 0020334 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
timeFormat = require("../"),
date = require("./date");
tape("isoParse as ISO 8601", function(test) {
test.deepEqual(timeFormat.isoParse("1990-01-01T00:00:00.000Z"), date.utc(1990, 0, 1, 0, 0, 0));
test.deepEqual(timeFormat.isoParse("2011-12-31T23:59:59.000Z"), date.utc(2011, 11, 31, 23, 59, 59));
test.equal(timeFormat.isoParse("1990-01-01T00:00:00.000X"), null);
test.end();
});
d3-time-format-2.1.3/test/locale-test.js 0000664 0000000 0000000 00000001646 13340071377 0020012 0 ustar 00root root 0000000 0000000 var fs = require("fs"),
path = require("path"),
tape = require("tape"),
queue = require("d3-queue"),
d3 = require("../");
tape("locale data is valid", function(test) {
fs.readdir("locale", function(error, locales) {
if (error) throw error;
var q = queue.queue(1);
locales.forEach(function(locale) {
if (!/\.json$/i.test(locale)) return;
q.defer(testLocale, path.join("locale", locale));
});
q.awaitAll(function(error) {
if (error) throw error;
test.end();
});
});
function testLocale(locale, callback) {
fs.readFile(locale, "utf8", function(error, locale) {
if (error) return void callback(error);
locale = JSON.parse(locale);
test.deepEqual(Object.keys(locale).sort(), ["date", "dateTime", "days", "months", "periods", "shortDays", "shortMonths", "time"]);
locale = d3.timeFormatLocale(locale);
callback(null);
});
}
});
d3-time-format-2.1.3/test/parse-test.js 0000664 0000000 0000000 00000030450 13340071377 0017660 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
timeFormat = require("../"),
date = require("./date"),
FiFi = require("../locale/fi-FI");
tape("parse(string) coerces the specified string to a string", function(test) {
var p = timeFormat.timeParse("%c");
test.deepEqual(p({toString: function() { return "1/1/1990, 12:00:00 AM"; }}), date.local(1990, 0, 1));
test.deepEqual(p({toString: function() { return "1/2/1990, 12:00:00 AM"; }}), date.local(1990, 0, 2));
test.deepEqual(p({toString: function() { return "1/3/1990, 12:00:00 AM"; }}), date.local(1990, 0, 3));
test.deepEqual(p({toString: function() { return "1/4/1990, 12:00:00 AM"; }}), date.local(1990, 0, 4));
test.deepEqual(p({toString: function() { return "1/5/1990, 12:00:00 AM"; }}), date.local(1990, 0, 5));
test.deepEqual(p({toString: function() { return "1/6/1990, 12:00:00 AM"; }}), date.local(1990, 0, 6));
test.deepEqual(p({toString: function() { return "1/7/1990, 12:00:00 AM"; }}), date.local(1990, 0, 7));
test.end();
});
tape("timeParse(\"%a %m/%d/%Y\")(date) parses abbreviated weekday and date", function(test) {
var p = timeFormat.timeParse("%a %m/%d/%Y");
test.deepEqual(p("Sun 01/01/1990"), date.local(1990, 0, 1));
test.deepEqual(p("Wed 02/03/1991"), date.local(1991, 1, 3));
test.equal(p("XXX 03/10/2010"), null);
test.end();
});
tape("timeParse(\"%A %m/%d/%Y\")(date) parses weekday and date", function(test) {
var p = timeFormat.timeParse("%A %m/%d/%Y");
test.deepEqual(p("Sunday 01/01/1990"), date.local(1990, 0, 1));
test.deepEqual(p("Wednesday 02/03/1991"), date.local(1991, 1, 3));
test.equal(p("Caturday 03/10/2010"), null);
test.end();
});
tape("timeParse(\"%U %Y\")(date) parses week number (Sunday) and year", function(test) {
var p = timeFormat.timeParse("%U %Y");
test.deepEqual(p("00 1990"), date.local(1989, 11, 31));
test.deepEqual(p("05 1991"), date.local(1991, 1, 3));
test.deepEqual(p("01 1995"), date.local(1995, 0, 1));
test.end();
});
tape("timeParse(\"%a %U %Y\")(date) parses abbreviated weekday, week number (Sunday) and year", function(test) {
var p = timeFormat.timeParse("%a %U %Y");
test.deepEqual(p("Mon 00 1990"), date.local(1990, 0, 1));
test.deepEqual(p("Sun 05 1991"), date.local(1991, 1, 3));
test.deepEqual(p("Sun 01 1995"), date.local(1995, 0, 1));
test.equal(p("XXX 03 2010"), null);
test.end();
});
tape("timeParse(\"%A %U %Y\")(date) parses weekday, week number (Sunday) and year", function(test) {
var p = timeFormat.timeParse("%A %U %Y");
test.deepEqual(p("Monday 00 1990"), date.local(1990, 0, 1));
test.deepEqual(p("Sunday 05 1991"), date.local(1991, 1, 3));
test.deepEqual(p("Sunday 01 1995"), date.local(1995, 0, 1));
test.equal(p("Caturday 03 2010"), null);
test.end();
});
tape("timeParse(\"%w %U %Y\")(date) parses numeric weekday (Sunday), week number (Sunday) and year", function(test) {
var p = timeFormat.timeParse("%w %U %Y");
test.deepEqual(p("1 00 1990"), date.local(1990, 0, 1));
test.deepEqual(p("0 05 1991"), date.local(1991, 1, 3));
test.deepEqual(p("0 01 1995"), date.local(1995, 0, 1));
test.equal(p("X 03 2010"), null);
test.end();
});
tape("timeParse(\"%w %V %Y\")(date) parses numeric weekday, week number (ISO) and year", function(test) {
var p = timeFormat.timeParse("%w %V %Y");
test.deepEqual(p("1 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("0 05 1991"), date.local(1991, 1, 3));
test.deepEqual(p("4 53 1992"), date.local(1992, 11, 31));
test.deepEqual(p("0 52 1994"), date.local(1995, 0, 1));
test.deepEqual(p("0 01 1995"), date.local(1995, 0, 8));
test.end();
});
tape("timeParse(\"%u %U %Y\")(date) parses numeric weekday (Monday), week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%u %W %Y");
test.deepEqual(p("1 00 1990"), date.local(1989, 11, 25));
test.deepEqual(p("1 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("1 05 1991"), date.local(1991, 1, 4));
test.deepEqual(p("7 00 1995"), date.local(1995, 0, 1));
test.deepEqual(p("1 01 1995"), date.local(1995, 0, 2));
test.equal(p("X 03 2010"), null);
test.end();
});
tape("timeParse(\"%W %Y\")(date) parses week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%W %Y");
test.deepEqual(p("01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("04 1991"), date.local(1991, 0, 28));
test.deepEqual(p("00 1995"), date.local(1994, 11, 26));
test.end();
});
tape("timeParse(\"%a %W %Y\")(date) parses abbreviated weekday, week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%a %W %Y");
test.deepEqual(p("Mon 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("Sun 04 1991"), date.local(1991, 1, 3));
test.deepEqual(p("Sun 00 1995"), date.local(1995, 0, 1));
test.equal(p("XXX 03 2010"), null);
test.end();
});
tape("timeParse(\"%A %W %Y\")(date) parses weekday, week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%A %W %Y");
test.deepEqual(p("Monday 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("Sunday 04 1991"), date.local(1991, 1, 3));
test.deepEqual(p("Sunday 00 1995"), date.local(1995, 0, 1));
test.equal(p("Caturday 03 2010"), null);
test.end();
});
tape("timeParse(\"%w %W %Y\")(date) parses numeric weekday (Sunday), week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%w %W %Y");
test.deepEqual(p("1 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("0 04 1991"), date.local(1991, 1, 3));
test.deepEqual(p("0 00 1995"), date.local(1995, 0, 1));
test.equal(p("X 03 2010"), null);
test.end();
});
tape("timeParse(\"%u %W %Y\")(date) parses numeric weekday (Monday), week number (Monday) and year", function(test) {
var p = timeFormat.timeParse("%u %W %Y");
test.deepEqual(p("1 01 1990"), date.local(1990, 0, 1));
test.deepEqual(p("7 04 1991"), date.local(1991, 1, 3));
test.deepEqual(p("7 00 1995"), date.local(1995, 0, 1));
test.equal(p("X 03 2010"), null);
test.end();
});
tape("timeParse(\"%m/%d/%y\")(date) parses month, date and two-digit year", function(test) {
var p = timeFormat.timeParse("%m/%d/%y");
test.deepEqual(p("02/03/69"), date.local(1969, 1, 3));
test.deepEqual(p("01/01/90"), date.local(1990, 0, 1));
test.deepEqual(p("02/03/91"), date.local(1991, 1, 3));
test.deepEqual(p("02/03/68"), date.local(2068, 1, 3));
test.equal(p("03/10/2010"), null);
test.end();
});
tape("timeParse(\"%x\")(date) parses locale date", function(test) {
var p = timeFormat.timeParse("%x");
test.deepEqual(p("1/1/1990"), date.local(1990, 0, 1));
test.deepEqual(p("2/3/1991"), date.local(1991, 1, 3));
test.deepEqual(p("3/10/2010"), date.local(2010, 2, 10));
test.end();
});
tape("timeParse(\"%b %d, %Y\")(date) parses abbreviated month, date and year", function(test) {
var p = timeFormat.timeParse("%b %d, %Y");
test.deepEqual(p("jan 01, 1990"), date.local(1990, 0, 1));
test.deepEqual(p("feb 2, 2010"), date.local(2010, 1, 2));
test.equal(p("jan. 1, 1990"), null);
test.end();
});
tape("timeParse(\"%B %d, %Y\")(date) parses month, date and year", function(test) {
var p = timeFormat.timeParse("%B %d, %Y");
test.deepEqual(p("january 01, 1990"), date.local(1990, 0, 1));
test.deepEqual(p("February 2, 2010"), date.local(2010, 1, 2));
test.equal(p("jan 1, 1990"), null);
test.end();
});
tape("timeParse(\"%j %m/%d/%Y\")(date) parses day of year and date", function(test) {
var p = timeFormat.timeParse("%j %m/%d/%Y");
test.deepEqual(p("001 01/01/1990"), date.local(1990, 0, 1));
test.deepEqual(p("034 02/03/1991"), date.local(1991, 1, 3));
test.equal(p("2012 03/10/2010"), null);
test.end();
});
tape("timeParse(\"%c\")(date) parses locale date and time", function(test) {
var p = timeFormat.timeParse("%c");
test.deepEqual(p("1/1/1990, 12:00:00 AM"), date.local(1990, 0, 1));
test.end();
});
tape("timeParse(\"%H:%M:%S\")(date) parses twenty-four hour, minute and second", function(test) {
var p = timeFormat.timeParse("%H:%M:%S");
test.deepEqual(p("00:00:00"), date.local(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59"), date.local(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00"), date.local(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01"), date.local(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("23:59:59"), date.local(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("timeParse(\"%X\")(date) parses locale time", function(test) {
var p = timeFormat.timeParse("%X");
test.deepEqual(p("12:00:00 AM"), date.local(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59 AM"), date.local(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00 PM"), date.local(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01 PM"), date.local(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("11:59:59 PM"), date.local(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("timeParse(\"%L\")(date) parses milliseconds", function(test) {
var p = timeFormat.timeParse("%L");
test.deepEqual(p("432"), date.local(1900, 0, 1, 0, 0, 0, 432));
test.end();
});
tape("timeParse(\"%f\")(date) parses microseconds", function(test) {
var p = timeFormat.timeParse("%f");
test.deepEqual(p("432000"), date.local(1900, 0, 1, 0, 0, 0, 432));
test.end();
});
tape("timeParse(\"%I:%M:%S %p\")(date) parses twelve hour, minute and second", function(test) {
var p = timeFormat.timeParse("%I:%M:%S %p");
test.deepEqual(p("12:00:00 am"), date.local(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59 AM"), date.local(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00 pm"), date.local(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01 pm"), date.local(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("11:59:59 PM"), date.local(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("timeParse(\"%I %p\")(date) parses period in non-English locales", function(test) {
var p = timeFormat.timeFormatLocale(FiFi).parse("%I:%M:%S %p");
test.deepEqual(p("12:00:00 a.m."), date.local(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59 A.M."), date.local(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00 p.m."), date.local(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01 p.m."), date.local(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("11:59:59 P.M."), date.local(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("timeParse(\"%% %m/%d/%Y\")(date) parses literal %", function(test) {
var p = timeFormat.timeParse("%% %m/%d/%Y");
test.deepEqual(p("% 01/01/1990"), date.local(1990, 0, 1));
test.deepEqual(p("% 02/03/1991"), date.local(1991, 1, 3));
test.equal(p("%% 03/10/2010"), null);
test.end();
});
tape("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset", function(test) {
var p = timeFormat.timeParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +0000"), date.local(1990, 0, 1, 16));
test.deepEqual(p("01/02/1990 +0100"), date.local(1990, 0, 1, 15));
test.deepEqual(p("01/02/1990 +0130"), date.local(1990, 0, 1, 14, 30));
test.deepEqual(p("01/02/1990 -0100"), date.local(1990, 0, 1, 17));
test.deepEqual(p("01/02/1990 -0130"), date.local(1990, 0, 1, 17, 30));
test.deepEqual(p("01/02/1990 -0800"), date.local(1990, 0, 2, 0));
test.end();
});
tape("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form '+-hh:mm'", function(test) {
var p = timeFormat.timeParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +01:30"), date.local(1990, 0, 1, 14, 30));
test.deepEqual(p("01/02/1990 -01:30"), date.local(1990, 0, 1, 17, 30));
test.end();
});
tape("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form '+-hh'", function(test) {
var p = timeFormat.timeParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +01"), date.local(1990, 0, 1, 15));
test.deepEqual(p("01/02/1990 -01"), date.local(1990, 0, 1, 17));
test.end();
});
tape("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form 'Z'", function(test) {
var p = timeFormat.timeParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 Z"), date.local(1990, 0, 1, 16));
test.end();
});
tape("timeParse(\"%-m/%0d/%_Y\")(date) ignores optional padding modifier, skipping zeroes and spaces", function(test) {
var p = timeFormat.timeParse("%-m/%0d/%_Y");
test.deepEqual(p("01/ 1/1990"), date.local(1990, 0, 1));
test.end();
});
tape("timeParse(\"%b %d, %Y\")(date) doesn't crash when given weird strings", function(test) {
try {
Object.prototype.foo = 10;
var p = timeFormat.timeParse("%b %d, %Y");
test.equal(p("foo 1, 1990"), null);
} finally {
delete Object.prototype.foo;
}
test.end();
});
d3-time-format-2.1.3/test/utcFormat-test.js 0000664 0000000 0000000 00000025754 13340071377 0020525 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
time = require("d3-time"),
timeFormat = require("../"),
date = require("./date");
var formatMillisecond = timeFormat.utcFormat(".%L"),
formatSecond = timeFormat.utcFormat(":%S"),
formatMinute = timeFormat.utcFormat("%I:%M"),
formatHour = timeFormat.utcFormat("%I %p"),
formatDay = timeFormat.utcFormat("%a %d"),
formatWeek = timeFormat.utcFormat("%b %d"),
formatMonth = timeFormat.utcFormat("%B"),
formatYear = timeFormat.utcFormat("%Y");
function multi(d) {
return (time.utcSecond(d) < d ? formatMillisecond
: time.utcMinute(d) < d ? formatSecond
: time.utcHour(d) < d ? formatMinute
: time.utcDay(d) < d ? formatHour
: time.utcMonth(d) < d ? (time.utcWeek(d) < d ? formatDay : formatWeek)
: time.utcYear(d) < d ? formatMonth
: formatYear)(d);
}
tape("utcFormat(\"%a\")(date) formats abbreviated weekdays", function(test) {
var f = timeFormat.utcFormat("%a");
test.equal(f(date.utc(1990, 0, 1)), "Mon");
test.equal(f(date.utc(1990, 0, 2)), "Tue");
test.equal(f(date.utc(1990, 0, 3)), "Wed");
test.equal(f(date.utc(1990, 0, 4)), "Thu");
test.equal(f(date.utc(1990, 0, 5)), "Fri");
test.equal(f(date.utc(1990, 0, 6)), "Sat");
test.equal(f(date.utc(1990, 0, 7)), "Sun");
test.end();
});
tape("utcFormat(\"%A\")(date) formats weekdays", function(test) {
var f = timeFormat.utcFormat("%A");
test.equal(f(date.utc(1990, 0, 1)), "Monday");
test.equal(f(date.utc(1990, 0, 2)), "Tuesday");
test.equal(f(date.utc(1990, 0, 3)), "Wednesday");
test.equal(f(date.utc(1990, 0, 4)), "Thursday");
test.equal(f(date.utc(1990, 0, 5)), "Friday");
test.equal(f(date.utc(1990, 0, 6)), "Saturday");
test.equal(f(date.utc(1990, 0, 7)), "Sunday");
test.end();
});
tape("utcFormat(\"%b\")(date) formats abbreviated months", function(test) {
var f = timeFormat.utcFormat("%b");
test.equal(f(date.utc(1990, 0, 1)), "Jan");
test.equal(f(date.utc(1990, 1, 1)), "Feb");
test.equal(f(date.utc(1990, 2, 1)), "Mar");
test.equal(f(date.utc(1990, 3, 1)), "Apr");
test.equal(f(date.utc(1990, 4, 1)), "May");
test.equal(f(date.utc(1990, 5, 1)), "Jun");
test.equal(f(date.utc(1990, 6, 1)), "Jul");
test.equal(f(date.utc(1990, 7, 1)), "Aug");
test.equal(f(date.utc(1990, 8, 1)), "Sep");
test.equal(f(date.utc(1990, 9, 1)), "Oct");
test.equal(f(date.utc(1990, 10, 1)), "Nov");
test.equal(f(date.utc(1990, 11, 1)), "Dec");
test.end();
});
tape("utcFormat(\"%B\")(date) formats months", function(test) {
var f = timeFormat.utcFormat("%B");
test.equal(f(date.utc(1990, 0, 1)), "January");
test.equal(f(date.utc(1990, 1, 1)), "February");
test.equal(f(date.utc(1990, 2, 1)), "March");
test.equal(f(date.utc(1990, 3, 1)), "April");
test.equal(f(date.utc(1990, 4, 1)), "May");
test.equal(f(date.utc(1990, 5, 1)), "June");
test.equal(f(date.utc(1990, 6, 1)), "July");
test.equal(f(date.utc(1990, 7, 1)), "August");
test.equal(f(date.utc(1990, 8, 1)), "September");
test.equal(f(date.utc(1990, 9, 1)), "October");
test.equal(f(date.utc(1990, 10, 1)), "November");
test.equal(f(date.utc(1990, 11, 1)), "December");
test.end();
});
tape("utcFormat(\"%c\")(date) formats localized dates and times", function(test) {
var f = timeFormat.utcFormat("%c");
test.equal(f(date.utc(1990, 0, 1)), "1/1/1990, 12:00:00 AM");
test.end();
});
tape("utcFormat(\"%d\")(date) formats zero-padded dates", function(test) {
var f = timeFormat.utcFormat("%d");
test.equal(f(date.utc(1990, 0, 1)), "01");
test.end();
});
tape("utcFormat(\"%e\")(date) formats space-padded dates", function(test) {
var f = timeFormat.utcFormat("%e");
test.equal(f(date.utc(1990, 0, 1)), " 1");
test.end();
});
tape("utcFormat(\"%H\")(date) formats zero-padded hours (24)", function(test) {
var f = timeFormat.utcFormat("%H");
test.equal(f(date.utc(1990, 0, 1, 0)), "00");
test.equal(f(date.utc(1990, 0, 1, 13)), "13");
test.end();
});
tape("utcFormat(\"%I\")(date) formats zero-padded hours (12)", function(test) {
var f = timeFormat.utcFormat("%I");
test.equal(f(date.utc(1990, 0, 1, 0)), "12");
test.equal(f(date.utc(1990, 0, 1, 13)), "01");
test.end();
});
tape("utcFormat(\"%j\")(date) formats zero-padded day of year numbers", function(test) {
var f = timeFormat.utcFormat("%j");
test.equal(f(date.utc(1990, 0, 1)), "001");
test.equal(f(date.utc(1990, 5, 1)), "152");
test.equal(f(date.utc(2010, 2, 13)), "072");
test.equal(f(date.utc(2010, 2, 14)), "073"); // DST begins
test.equal(f(date.utc(2010, 2, 15)), "074");
test.equal(f(date.utc(2010, 10, 6)), "310");
test.equal(f(date.utc(2010, 10, 7)), "311"); // DST ends
test.equal(f(date.utc(2010, 10, 8)), "312");
test.end();
});
tape("utcFormat(\"%m\")(date) formats zero-padded months", function(test) {
var f = timeFormat.utcFormat("%m");
test.equal(f(date.utc(1990, 0, 1)), "01");
test.equal(f(date.utc(1990, 9, 1)), "10");
test.end();
});
tape("utcFormat(\"%M\")(date) formats zero-padded minutes", function(test) {
var f = timeFormat.utcFormat("%M");
test.equal(f(date.utc(1990, 0, 1, 0, 0)), "00");
test.equal(f(date.utc(1990, 0, 1, 0, 32)), "32");
test.end();
});
tape("utcFormat(\"%p\")(date) formats AM or PM", function(test) {
var f = timeFormat.utcFormat("%p");
test.equal(f(date.utc(1990, 0, 1, 0)), "AM");
test.equal(f(date.utc(1990, 0, 1, 13)), "PM");
test.end();
});
tape("utcFormat(\"%Q\")(date) formats UNIX timestamps", function(test) {
var f = timeFormat.utcFormat("%Q");
test.equal(f(date.utc(1970, 0, 1, 0, 0, 0)), "0");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "631152000000");
test.equal(f(date.utc(1990, 0, 1, 12, 34, 56)), "631197296000");
test.end();
});
tape("utcFormat(\"%s\")(date) formats UNIX timetamps in seconds", function(test) {
var f = timeFormat.utcFormat("%s");
test.equal(f(date.utc(1970, 0, 1, 0, 0, 0)), "0");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "631152000");
test.equal(f(date.utc(1990, 0, 1, 12, 34, 56)), "631197296");
test.end();
});
tape("utcFormat(\"%S\")(date) formats zero-padded seconds", function(test) {
var f = timeFormat.utcFormat("%S");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "00");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 32)), "32");
var f = timeFormat.utcFormat("%0S");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "00");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("utcFormat(\"%_S\")(date) formats space-padded seconds", function(test) {
var f = timeFormat.utcFormat("%_S");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), " 0");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 3)), " 3");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("utcFormat(\"-S\")(date) formats no-padded seconds", function(test) {
var f = timeFormat.utcFormat("%-S");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "0");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 3)), "3");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 32)), "32");
test.end();
});
tape("utcFormat(\"%L\")(date) formats zero-padded milliseconds", function(test) {
var f = timeFormat.utcFormat("%L");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0, 0)), "000");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0, 432)), "432");
test.end();
});
tape("utcFormat(\"%u\")(date) formats week day numbers", function(test) {
var f = timeFormat.utcFormat("%u");
test.equal(f(date.utc(1990, 0, 1, 0)), "1");
test.equal(f(date.utc(1990, 0, 7, 0)), "7");
test.equal(f(date.utc(2010, 2, 13, 23)), "6");
test.end();
});
tape("utcFormat(\"%f\")(date) formats zero-padded microseconds", function(test) {
var f = timeFormat.utcFormat("%f");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0, 0)), "000000");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0, 432)), "432000");
test.end();
});
tape("utcFormat(\"%U\")(date) formats zero-padded week numbers", function(test) {
var f = timeFormat.utcFormat("%U");
test.equal(f(date.utc(1990, 0, 1, 0)), "00");
test.equal(f(date.utc(1990, 5, 1, 0)), "21");
test.equal(f(date.utc(2010, 2, 13, 23)), "10");
test.equal(f(date.utc(2010, 2, 14, 0)), "11"); // DST begins
test.equal(f(date.utc(2010, 2, 15, 0)), "11");
test.equal(f(date.utc(2010, 10, 6, 23)), "44");
test.equal(f(date.utc(2010, 10, 7, 0)), "45"); // DST ends
test.equal(f(date.utc(2010, 10, 8, 0)), "45");
test.end();
});
tape("utcFormat(\"%V\")(date) formats zero-padded ISO 8601 week numbers", function(test) {
var f = timeFormat.utcFormat("%V");
test.equal(f(date.utc(1990, 0, 1, 0)), "01");
test.equal(f(date.utc(1990, 5, 1, 0)), "22");
test.equal(f(date.utc(2010, 2, 13, 23)), "10");
test.equal(f(date.utc(2010, 2, 14, 0)), "10"); // DST begins
test.equal(f(date.utc(2010, 2, 15, 0)), "11");
test.equal(f(date.utc(2010, 10, 6, 23)), "44");
test.equal(f(date.utc(2010, 10, 7, 0)), "44"); // DST ends
test.equal(f(date.utc(2010, 10, 8, 0)), "45");
test.equal(f(date.utc(2015, 11, 31, 0)), "53");
test.equal(f(date.utc(2016, 0, 1, 0)), "53");
test.end();
});
tape("utcFormat(\"%x\")(date) formats localized dates", function(test) {
var f = timeFormat.utcFormat("%x");
test.equal(f(date.utc(1990, 0, 1)), "1/1/1990");
test.equal(f(date.utc(2010, 5, 1)), "6/1/2010");
test.end();
});
tape("utcFormat(\"%X\")(date) formats localized times", function(test) {
var f = timeFormat.utcFormat("%X");
test.equal(f(date.utc(1990, 0, 1, 0, 0, 0)), "12:00:00 AM");
test.equal(f(date.utc(1990, 0, 1, 13, 34, 59)), "1:34:59 PM");
test.end();
});
tape("utcFormat(\"%y\")(date) formats zero-padded two-digit years", function(test) {
var f = timeFormat.utcFormat("%y");
test.equal(f(date.utc(+1990, 0, 1)), "90");
test.equal(f(date.utc(+2002, 0, 1)), "02");
test.equal(f(date.utc(-0002, 0, 1)), "-02");
test.end();
});
tape("utcFormat(\"%Y\")(date) formats zero-padded four-digit years", function(test) {
var f = timeFormat.utcFormat("%Y");
test.equal(f(date.utc( 123, 0, 1)), "0123");
test.equal(f(date.utc( 1990, 0, 1)), "1990");
test.equal(f(date.utc( 2002, 0, 1)), "2002");
test.equal(f(date.utc(10002, 0, 1)), "0002");
test.equal(f(date.utc( -2, 0, 1)), "-0002");
test.end();
});
tape("utcFormat(\"%Z\")(date) formats time zones", function(test) {
var f = timeFormat.utcFormat("%Z");
test.equal(f(date.utc(1990, 0, 1)), "+0000");
test.end();
});
tape("utcFormat(\"%%\")(date) formats literal percent signs", function(test) {
var f = timeFormat.utcFormat("%%");
test.equal(f(date.utc(1990, 0, 1)), "%");
test.end();
});
tape("utcFormat(…) can be used to create a conditional multi-format", function(test) {
test.equal(multi(date.utc(1990, 0, 1, 0, 0, 0, 12)), ".012");
test.equal(multi(date.utc(1990, 0, 1, 0, 0, 1, 0)), ":01");
test.equal(multi(date.utc(1990, 0, 1, 0, 1, 0, 0)), "12:01");
test.equal(multi(date.utc(1990, 0, 1, 1, 0, 0, 0)), "01 AM");
test.equal(multi(date.utc(1990, 0, 2, 0, 0, 0, 0)), "Tue 02");
test.equal(multi(date.utc(1990, 1, 1, 0, 0, 0, 0)), "February");
test.equal(multi(date.utc(1990, 0, 1, 0, 0, 0, 0)), "1990");
test.end();
});
d3-time-format-2.1.3/test/utcParse-test.js 0000664 0000000 0000000 00000014755 13340071377 0020346 0 ustar 00root root 0000000 0000000 var tape = require("tape"),
timeFormat = require("../"),
date = require("./date");
tape("utcParse(\"\")(date) parses abbreviated weekday and numeric date", function(test) {
var p = timeFormat.utcParse("%a %m/%d/%Y");
test.deepEqual(p("Sun 01/01/1990"), date.utc(1990, 0, 1));
test.deepEqual(p("Wed 02/03/1991"), date.utc(1991, 1, 3));
test.equal(p("XXX 03/10/2010"), null);
test.end();
});
tape("utcParse(\"\")(date) parses weekday and numeric date", function(test) {
var p = timeFormat.utcParse("%A %m/%d/%Y");
test.deepEqual(p("Sunday 01/01/1990"), date.utc(1990, 0, 1));
test.deepEqual(p("Wednesday 02/03/1991"), date.utc(1991, 1, 3));
test.equal(p("Caturday 03/10/2010"), null);
test.end();
});
tape("utcParse(\"\")(date) parses numeric date", function(test) {
var p = timeFormat.utcParse("%m/%d/%y");
test.deepEqual(p("01/01/90"), date.utc(1990, 0, 1));
test.deepEqual(p("02/03/91"), date.utc(1991, 1, 3));
test.equal(p("03/10/2010"), null);
test.end();
});
tape("utcParse(\"\")(date) parses locale date", function(test) {
var p = timeFormat.utcParse("%x");
test.deepEqual(p("01/01/1990"), date.utc(1990, 0, 1));
test.deepEqual(p("02/03/1991"), date.utc(1991, 1, 3));
test.deepEqual(p("03/10/2010"), date.utc(2010, 2, 10));
test.end();
});
tape("utcParse(\"\")(date) parses abbreviated month, date and year", function(test) {
var p = timeFormat.utcParse("%b %d, %Y");
test.deepEqual(p("jan 01, 1990"), date.utc(1990, 0, 1));
test.deepEqual(p("feb 2, 2010"), date.utc(2010, 1, 2));
test.equal(p("jan. 1, 1990"), null);
test.end();
});
tape("utcParse(\"\")(date) parses month, date and year", function(test) {
var p = timeFormat.utcParse("%B %d, %Y");
test.deepEqual(p("january 01, 1990"), date.utc(1990, 0, 1));
test.deepEqual(p("February 2, 2010"), date.utc(2010, 1, 2));
test.equal(p("jan 1, 1990"), null);
test.end();
});
tape("utcParse(\"\")(date) parses locale date and time", function(test) {
var p = timeFormat.utcParse("%c");
test.deepEqual(p("1/1/1990, 12:00:00 AM"), date.utc(1990, 0, 1));
test.end();
});
tape("utcParse(\"\")(date) parses twenty-four hour, minute and second", function(test) {
var p = timeFormat.utcParse("%H:%M:%S");
test.deepEqual(p("00:00:00"), date.utc(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59"), date.utc(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00"), date.utc(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01"), date.utc(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("23:59:59"), date.utc(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("utcParse(\"\")(date) parses locale time", function(test) {
var p = timeFormat.utcParse("%X");
test.deepEqual(p("12:00:00 AM"), date.utc(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59 AM"), date.utc(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00 PM"), date.utc(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01 PM"), date.utc(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("11:59:59 PM"), date.utc(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("utcParse(\"%L\")(date) parses milliseconds", function(test) {
var p = timeFormat.utcParse("%L");
test.deepEqual(p("432"), date.utc(1900, 0, 1, 0, 0, 0, 432));
test.end();
});
tape("utcParse(\"%f\")(date) parses microseconds", function(test) {
var p = timeFormat.utcParse("%f");
test.deepEqual(p("432000"), date.utc(1900, 0, 1, 0, 0, 0, 432));
test.end();
});
tape("utcParse(\"\")(date) parses twelve hour, minute and second", function(test) {
var p = timeFormat.utcParse("%I:%M:%S %p");
test.deepEqual(p("12:00:00 am"), date.utc(1900, 0, 1, 0, 0, 0));
test.deepEqual(p("11:59:59 AM"), date.utc(1900, 0, 1, 11, 59, 59));
test.deepEqual(p("12:00:00 pm"), date.utc(1900, 0, 1, 12, 0, 0));
test.deepEqual(p("12:00:01 pm"), date.utc(1900, 0, 1, 12, 0, 1));
test.deepEqual(p("11:59:59 PM"), date.utc(1900, 0, 1, 23, 59, 59));
test.end();
});
tape("utcParse(\"\")(date) parses timezone offset", function(test) {
var p = timeFormat.utcParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +0000"), date.utc(1990, 0, 2));
test.deepEqual(p("01/02/1990 +0100"), date.utc(1990, 0, 1, 23));
test.deepEqual(p("01/02/1990 -0100"), date.utc(1990, 0, 2, 1));
test.deepEqual(p("01/02/1990 -0800"), date.local(1990, 0, 2));
test.end();
});
tape("utcParse(\"\")(date) parses timezone offset (in the form '+-hh:mm')", function(test) {
var p = timeFormat.utcParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +01:30"), date.utc(1990, 0, 1, 22, 30));
test.deepEqual(p("01/02/1990 -01:30"), date.utc(1990, 0, 2, 1, 30));
test.end();
});
tape("utcParse(\"\")(date) parses timezone offset (in the form '+-hh')", function(test) {
var p = timeFormat.utcParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 +01"), date.utc(1990, 0, 1, 23));
test.deepEqual(p("01/02/1990 -01"), date.utc(1990, 0, 2, 1));
test.end();
});
tape("utcParse(\"\")(date) parses timezone offset (in the form 'Z')", function(test) {
var p = timeFormat.utcParse("%m/%d/%Y %Z");
test.deepEqual(p("01/02/1990 Z"), date.utc(1990, 0, 2));
test.end();
});
tape("utcParse(\"%w %V %Y\")(date) parses numeric weekday, week number (ISO) and year", function(test) {
var p = timeFormat.timeParse("%w %V %Y %Z");
test.deepEqual(p("1 01 1990 Z"), date.utc(1990, 0, 1));
test.deepEqual(p("0 05 1991 Z"), date.utc(1991, 1, 3));
test.deepEqual(p("4 53 1992 Z"), date.utc(1992, 11, 31));
test.deepEqual(p("0 52 1994 Z"), date.utc(1995, 0, 1));
test.deepEqual(p("0 01 1995 Z"), date.utc(1995, 0, 8));
test.equal(p("X 03 2010"), null);
test.end();
});
tape("utcParse(\"%V %Y\")(date) week number (ISO) and year", function(test) {
var p = timeFormat.timeParse("%V %Y %Z");
test.deepEqual(p("01 1990 Z"), date.utc(1990, 0, 1));
test.deepEqual(p("05 1991 Z"), date.utc(1991, 0, 28));
test.deepEqual(p("53 1992 Z"), date.utc(1992, 11, 28));
test.deepEqual(p("01 1993 Z"), date.utc(1993, 0, 4));
test.deepEqual(p("01 1995 Z"), date.utc(1995, 0, 2));
test.deepEqual(p("00 1995 Z"), null);
test.deepEqual(p("54 1995 Z"), null);
test.deepEqual(p("X 1995 Z"), null);
test.end();
});
tape("utcParse(\"\")(date) parses Unix timestamps", function(test) {
var p = timeFormat.utcParse("%Q");
test.deepEqual(p("0"), date.utc(1970, 0, 1));
test.deepEqual(p("631152000000"), date.utc(1990, 0, 1));
test.end();
});
tape("utcParse(\"\")(date) parses Unix timestamps in seconds", function(test) {
var p = timeFormat.utcParse("%s");
test.deepEqual(p("0"), date.utc(1970, 0, 1));
test.deepEqual(p("631152000"), date.utc(1990, 0, 1));
test.end();
});
d3-time-format-2.1.3/yarn.lock 0000664 0000000 0000000 00000077151 13340071377 0016110 0 ustar 00root root 0000000 0000000 # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@^7.0.0-beta.47":
version "7.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.3.tgz#d77a587401f818a3168700f596e41cd6905947b2"
dependencies:
"@babel/highlight" "7.0.0-rc.3"
"@babel/highlight@7.0.0-rc.3":
version "7.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.3.tgz#c2ee83f8e5c0c387279a8c48e06fef2e32027004"
dependencies:
chalk "^2.0.0"
esutils "^2.0.2"
js-tokens "^4.0.0"
"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
"@types/node@*":
version "10.9.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.9.1.tgz#06f002136fbcf51e730995149050bb3c45ee54e6"
acorn-jsx@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e"
dependencies:
acorn "^5.0.3"
acorn@^5.0.3, acorn@^5.6.0:
version "5.7.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5"
ajv-keywords@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a"
ajv@^6.0.1, ajv@^6.5.0:
version "6.5.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9"
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-escapes@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
dependencies:
color-convert "^1.9.0"
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
dependencies:
sprintf-js "~1.0.2"
array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
dependencies:
array-uniq "^1.0.1"
array-uniq@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
dependencies:
chalk "^1.1.3"
esutils "^2.0.2"
js-tokens "^3.0.2"
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
caller-path@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
dependencies:
callsites "^0.2.0"
callsites@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca"
chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^2.0.0, chalk@^2.1.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
circular-json@^0.3.1:
version "0.3.3"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"
cli-cursor@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
dependencies:
restore-cursor "^2.0.0"
cli-width@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
color-convert@^1.9.0:
version "1.9.2"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147"
dependencies:
color-name "1.1.1"
color-name@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689"
commander@~2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"
d3-queue@3:
version "3.0.7"
resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618"
d3-time@1:
version "1.0.9"
resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.9.tgz#ca7eebbcfe99c76cc837f903c7438defd28b73fe"
debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"
deep-equal@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
define-properties@^1.1.2:
version "1.1.3"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
dependencies:
object-keys "^1.0.12"
defined@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
del@^2.0.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
dependencies:
globby "^5.0.0"
is-path-cwd "^1.0.0"
is-path-in-cwd "^1.0.0"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"
rimraf "^2.2.8"
doctrine@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
dependencies:
esutils "^2.0.2"
es-abstract@^1.5.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
has "^1.0.1"
is-callable "^1.1.3"
is-regex "^1.0.4"
es-to-primitive@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d"
dependencies:
is-callable "^1.1.1"
is-date-object "^1.0.1"
is-symbol "^1.0.1"
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
eslint-scope@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172"
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-utils@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512"
eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
eslint@5:
version "5.4.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62"
dependencies:
ajv "^6.5.0"
babel-code-frame "^6.26.0"
chalk "^2.1.0"
cross-spawn "^6.0.5"
debug "^3.1.0"
doctrine "^2.1.0"
eslint-scope "^4.0.0"
eslint-utils "^1.3.1"
eslint-visitor-keys "^1.0.0"
espree "^4.0.0"
esquery "^1.0.1"
esutils "^2.0.2"
file-entry-cache "^2.0.0"
functional-red-black-tree "^1.0.1"
glob "^7.1.2"
globals "^11.7.0"
ignore "^4.0.2"
imurmurhash "^0.1.4"
inquirer "^5.2.0"
is-resolvable "^1.1.0"
js-yaml "^3.11.0"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.5"
minimatch "^3.0.4"
mkdirp "^0.5.1"
natural-compare "^1.4.0"
optionator "^0.8.2"
path-is-inside "^1.0.2"
pluralize "^7.0.0"
progress "^2.0.0"
regexpp "^2.0.0"
require-uncached "^1.0.3"
semver "^5.5.0"
strip-ansi "^4.0.0"
strip-json-comments "^2.0.1"
table "^4.0.3"
text-table "^0.2.0"
espree@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634"
dependencies:
acorn "^5.6.0"
acorn-jsx "^4.1.1"
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
esquery@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"
dependencies:
estraverse "^4.0.0"
esrecurse@^4.1.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf"
dependencies:
estraverse "^4.1.0"
estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
external-editor@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5"
dependencies:
chardet "^0.4.0"
iconv-lite "^0.4.17"
tmp "^0.0.33"
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
figures@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
dependencies:
escape-string-regexp "^1.0.5"
file-entry-cache@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361"
dependencies:
flat-cache "^1.2.1"
object-assign "^4.0.1"
flat-cache@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481"
dependencies:
circular-json "^0.3.1"
del "^2.0.2"
graceful-fs "^4.1.2"
write "^0.2.1"
for-each@~0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
dependencies:
is-callable "^1.1.3"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@~7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
globals@^11.7.0:
version "11.7.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673"
globby@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d"
dependencies:
array-union "^1.0.1"
arrify "^1.0.0"
glob "^7.0.3"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"
graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
dependencies:
ansi-regex "^2.0.0"
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
has@^1.0.1, has@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
dependencies:
function-bind "^1.1.1"
iconv-lite@^0.4.17:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
dependencies:
safer-buffer ">= 2.1.2 < 3"
ignore@^4.0.2:
version "4.0.6"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@~2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
inquirer@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726"
dependencies:
ansi-escapes "^3.0.0"
chalk "^2.0.0"
cli-cursor "^2.1.0"
cli-width "^2.0.0"
external-editor "^2.1.0"
figures "^2.0.0"
lodash "^4.3.0"
mute-stream "0.0.7"
run-async "^2.2.0"
rxjs "^5.5.2"
string-width "^2.1.0"
strip-ansi "^4.0.0"
through "^2.3.6"
is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
is-fullwidth-code-point@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
is-path-cwd@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d"
is-path-in-cwd@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52"
dependencies:
is-path-inside "^1.0.0"
is-path-inside@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036"
dependencies:
path-is-inside "^1.0.1"
is-promise@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
dependencies:
has "^1.0.1"
is-resolvable@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"
is-symbol@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572"
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
js-tokens@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
js-yaml@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
json-stable-stringify-without-jsonify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
levn@^0.3.0, levn@~0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
dependencies:
prelude-ls "~1.1.2"
type-check "~0.3.2"
lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0:
version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
mimic-fn@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
brace-expansion "^1.1.7"
minimist@0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
minimist@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
mkdirp@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
mute-stream@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
nice-try@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"
object-assign@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
object-inspect@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b"
object-keys@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
wrappy "1"
onetime@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
dependencies:
mimic-fn "^1.0.0"
optionator@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
dependencies:
deep-is "~0.1.3"
fast-levenshtein "~2.0.4"
levn "~0.3.0"
prelude-ls "~1.1.2"
type-check "~0.3.2"
wordwrap "~1.0.0"
os-tmpdir@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
path-is-inside@^1.0.1, path-is-inside@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
path-parse@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
pify@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
pinkie-promise@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
dependencies:
pinkie "^2.0.0"
pinkie@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
pluralize@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"
prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
progress@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
punycode@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
regexpp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365"
require-uncached@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3"
dependencies:
caller-path "^0.1.0"
resolve-from "^1.0.0"
resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
resolve@~1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
dependencies:
path-parse "^1.0.5"
restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
dependencies:
onetime "^2.0.0"
signal-exit "^3.0.2"
resumer@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759"
dependencies:
through "~2.3.4"
rimraf@^2.2.8:
version "2.6.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
dependencies:
glob "^7.0.5"
rollup-plugin-terser@1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-1.0.1.tgz#ba5f497cbc9aa38ba19d3ee2167c04ea3ed279af"
dependencies:
"@babel/code-frame" "^7.0.0-beta.47"
terser "^3.7.5"
rollup@0.64:
version "0.64.1"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.64.1.tgz#9188ee368e5fcd43ffbc00ec414e72eeb5de87ba"
dependencies:
"@types/estree" "0.0.39"
"@types/node" "*"
run-async@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
dependencies:
is-promise "^2.1.0"
rxjs@^5.5.2:
version "5.5.11"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87"
dependencies:
symbol-observable "1.0.1"
"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
semver@^5.5.0:
version "5.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
dependencies:
shebang-regex "^1.0.0"
shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
slice-ansi@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d"
dependencies:
is-fullwidth-code-point "^2.0.0"
source-map-support@~0.5.6:
version "0.5.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map@^0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
string-width@^2.1.0, string-width@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
dependencies:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
string.prototype.trim@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea"
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.0"
function-bind "^1.0.2"
strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
dependencies:
ansi-regex "^2.0.0"
strip-ansi@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
dependencies:
ansi-regex "^3.0.0"
strip-json-comments@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
dependencies:
has-flag "^3.0.0"
symbol-observable@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
table@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc"
dependencies:
ajv "^6.0.1"
ajv-keywords "^3.0.0"
chalk "^2.1.0"
lodash "^4.17.4"
slice-ansi "1.0.0"
string-width "^2.1.1"
tape@4:
version "4.9.1"
resolved "https://registry.yarnpkg.com/tape/-/tape-4.9.1.tgz#1173d7337e040c76fbf42ec86fcabedc9b3805c9"
dependencies:
deep-equal "~1.0.1"
defined "~1.0.0"
for-each "~0.3.3"
function-bind "~1.1.1"
glob "~7.1.2"
has "~1.0.3"
inherits "~2.0.3"
minimist "~1.2.0"
object-inspect "~1.6.0"
resolve "~1.7.1"
resumer "~0.0.0"
string.prototype.trim "~1.1.2"
through "~2.3.8"
terser@^3.7.5:
version "3.8.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.8.1.tgz#cb70070ac9e0a71add169dfb63c0a64fca2738ac"
dependencies:
commander "~2.16.0"
source-map "~0.6.1"
source-map-support "~0.5.6"
text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
through@^2.3.6, through@~2.3.4, through@~2.3.8:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
dependencies:
os-tmpdir "~1.0.2"
type-check@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
dependencies:
prelude-ls "~1.1.2"
uri-js@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
dependencies:
punycode "^2.1.0"
which@^1.2.9:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
dependencies:
isexe "^2.0.0"
wordwrap@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
write@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757"
dependencies:
mkdirp "^0.5.1"