├── .eslintrc.json ├── .github ├── eslint.json └── workflows │ └── node.js.yml ├── .gitignore ├── LICENSE ├── README.md ├── locale ├── ar-EG.json ├── ar-SY.json ├── ca-ES.json ├── cs-CZ.json ├── da-DK.json ├── de-CH.json ├── de-DE.json ├── en-CA.json ├── en-GB.json ├── en-US.json ├── es-ES.json ├── es-MX.json ├── fa-IR.json ├── fi-FI.json ├── fr-CA.json ├── fr-FR.json ├── he-IL.json ├── hr-HR.json ├── hu-HU.json ├── it-IT.json ├── ja-JP.json ├── ko-KR.json ├── mk-MK.json ├── nb-NO.json ├── nl-BE.json ├── nl-NL.json ├── pl-PL.json ├── pt-BR.json ├── ru-RU.json ├── sv-SE.json ├── tr-TR.json ├── uk-UA.json ├── vi-VN.json ├── zh-CN.json └── zh-TW.json ├── package.json ├── rollup.config.js ├── src ├── defaultLocale.js ├── index.js ├── isoFormat.js ├── isoParse.js └── locale.js ├── test ├── .eslintrc.json ├── date.js ├── defaultLocale-test.js ├── format-test.js ├── isoFormat-test.js ├── isoParse-test.js ├── locale-test.js ├── parse-test.js ├── utcFormat-test.js └── utcParse-test.js └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "parserOptions": { 4 | "sourceType": "module", 5 | "ecmaVersion": 8 6 | }, 7 | "env": { 8 | "es6": true 9 | }, 10 | "rules": { 11 | "no-cond-assign": 0 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.github/eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "eslint-compact", 5 | "pattern": [ 6 | { 7 | "regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$", 8 | "file": 1, 9 | "line": 2, 10 | "column": 3, 11 | "severity": 4, 12 | "message": 5, 13 | "code": 6 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 2 | 3 | name: Node.js CI 4 | 5 | on: 6 | push: 7 | branches: [ main ] 8 | pull_request: 9 | branches: [ main ] 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | strategy: 17 | matrix: 18 | node-version: [14.x] 19 | 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: Use Node.js ${{ matrix.node-version }} 23 | uses: actions/setup-node@v1 24 | with: 25 | node-version: ${{ matrix.node-version }} 26 | - run: yarn --frozen-lockfile 27 | - run: | 28 | echo ::add-matcher::.github/eslint.json 29 | yarn run eslint src test --format=compact 30 | - run: yarn test 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-workspace 2 | .DS_Store 3 | dist/ 4 | node_modules 5 | npm-debug.log 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010-2021 Mike Bostock 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # d3-time-format 2 | 3 | 4 | 5 | This module 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. 6 | 7 | ## Resources 8 | 9 | - [Documentation](https://d3js.org/d3-time-format) 10 | - [Releases](https://github.com/d3/d3-time-format/releases) 11 | - [Getting help](https://d3js.org/community) 12 | -------------------------------------------------------------------------------- /locale/ar-EG.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x, %X", 3 | "date": "%-d/%-m/%Y", 4 | "time": "%-I:%M:%S %p", 5 | "periods": ["ص", "م"], 6 | "days": ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], 7 | "shortDays": ["أحد", "إثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"], 8 | "months": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"], 9 | "shortMonths": ["يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/ar-SY.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x, %X", 3 | "date": "%-d/%-m/%Y", 4 | "time": "%-I:%M:%S %p", 5 | "periods": ["ص", "م"], 6 | "days": ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"], 7 | "shortDays": ["أحد", "إثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"], 8 | "months": ["كانون الثاني", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"], 9 | "shortMonths": ["ك٢", "شباط", "آذار", "نيسان", "أيار", "حزيران", "تموز", "آب", "أيلول", "ت١", "ت٢", "ك١"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/ca-ES.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e de %B de %Y, %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["diumenge", "dilluns", "dimarts", "dimecres", "dijous", "divendres", "dissabte"], 7 | "shortDays": ["dg.", "dl.", "dt.", "dc.", "dj.", "dv.", "ds."], 8 | "months": ["gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre"], 9 | "shortMonths": ["gen.", "febr.", "març", "abr.", "maig", "juny", "jul.", "ag.", "set.", "oct.", "nov.", "des."] 10 | } 11 | -------------------------------------------------------------------------------- /locale/cs-CZ.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A,%e.%B %Y, %X", 3 | "date": "%-d.%-m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["neděle", "pondělí", "úterý", "středa", "čvrtek", "pátek", "sobota"], 7 | "shortDays": ["ne.", "po.", "út.", "st.", "čt.", "pá.", "so."], 8 | "months": ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"], 9 | "shortMonths": ["led", "úno", "břez", "dub", "kvě", "čer", "červ", "srp", "zář", "říj", "list", "pros"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/da-DK.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A den %d %B %Y %X", 3 | "date": "%d-%m-%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], 7 | "shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"], 8 | "months": ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], 9 | "shortMonths": ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/de-CH.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, der %e. %B %Y, %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], 7 | "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 8 | "months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], 9 | "shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/de-DE.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, der %e. %B %Y, %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], 7 | "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 8 | "months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], 9 | "shortMonths": ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/en-CA.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %b %e %X %Y", 3 | "date": "%Y-%m-%d", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 7 | "shortDays": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 8 | "months": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 9 | "shortMonths": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/en-GB.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %e %b %X %Y", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 7 | "shortDays": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 8 | "months": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 9 | "shortMonths": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x, %X", 3 | "date": "%-m/%-d/%Y", 4 | "time": "%-I:%M:%S %p", 5 | "periods": ["AM", "PM"], 6 | "days": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 7 | "shortDays": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 8 | "months": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 9 | "shortMonths": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/es-ES.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e de %B de %Y, %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], 7 | "shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], 8 | "months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], 9 | "shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/es-MX.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x, %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%-I:%M:%S %p", 5 | "periods": ["AM", "PM"], 6 | "days": ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], 7 | "shortDays": ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"], 8 | "months": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], 9 | "shortMonths": ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/fa-IR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x, %X", 3 | "date": "%-d/%-m/%Y", 4 | "time": "%-I:%M:%S %p", 5 | "periods": ["صبح", "عصر"], 6 | "days": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], 7 | "shortDays": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"], 8 | "months": ["ژانویه", "فوریه", "مارس", "آوریل", "مه", "ژوئن", "ژوئیه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "دسامبر"], 9 | "shortMonths": ["ژانویه", "فوریه", "مارس", "آوریل", "مه", "ژوئن", "ژوئیه", "اوت", "سپتامبر", "اکتبر", "نوامبر", "دسامبر"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/fi-FI.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %-d. %Bta %Y klo %X", 3 | "date": "%-d.%-m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["a.m.", "p.m."], 6 | "days": ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"], 7 | "shortDays": ["Su", "Ma", "Ti", "Ke", "To", "Pe", "La"], 8 | "months": ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"], 9 | "shortMonths": ["Tammi", "Helmi", "Maalis", "Huhti", "Touko", "Kesä", "Heinä", "Elo", "Syys", "Loka", "Marras", "Joulu"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/fr-CA.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %e %b %Y %X", 3 | "date": "%Y-%m-%d", 4 | "time": "%H:%M:%S", 5 | "periods": ["", ""], 6 | "days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], 7 | "shortDays": ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], 8 | "months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], 9 | "shortMonths": ["jan", "fév", "mar", "avr", "mai", "jui", "jul", "aoû", "sep", "oct", "nov", "déc"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/fr-FR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A %e %B %Y à %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], 7 | "shortDays": ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."], 8 | "months": ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], 9 | "shortMonths": ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."] 10 | } 11 | -------------------------------------------------------------------------------- /locale/he-IL.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e ב%B %Y %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת"], 7 | "shortDays": ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"], 8 | "months": ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"], 9 | "shortMonths": ["ינו׳", "פבר׳", "מרץ", "אפר׳", "מאי", "יוני", "יולי", "אוג׳", "ספט׳", "אוק׳", "נוב׳", "דצמ׳"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/hr-HR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e. %B %Y., %X", 3 | "date": "%d. %m. %Y.", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvtrak", "Petak", "Subota"], 7 | "shortDays": ["Ne", "Po", "Ut", "Sr", "Če", "Pe", "Su"], 8 | "months": ["Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"], 9 | "shortMonths": ["Sij", "Velj", "Ožu", "Tra", "Svi", "Lip", "Srp", "Kol", "Ruj", "Lis", "Stu", "Pro"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/hu-HU.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%Y. %B %-e., %A %X", 3 | "date": "%Y. %m. %d.", 4 | "time": "%H:%M:%S", 5 | "periods": ["de.", "du."], 6 | "days": ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], 7 | "shortDays": ["V", "H", "K", "Sze", "Cs", "P", "Szo"], 8 | "months": ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], 9 | "shortMonths": ["jan.", "feb.", "már.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."] 10 | } 11 | -------------------------------------------------------------------------------- /locale/it-IT.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A %e %B %Y, %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"], 7 | "shortDays": ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], 8 | "months": ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"], 9 | "shortMonths": ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/ja-JP.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x %a %X", 3 | "date": "%Y/%m/%d", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], 7 | "shortDays": ["日", "月", "火", "水", "木", "金", "土"], 8 | "months": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], 9 | "shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/ko-KR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%Y/%m/%d %a %X", 3 | "date": "%Y/%m/%d", 4 | "time": "%H:%M:%S", 5 | "periods": ["오전", "오후"], 6 | "days": ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], 7 | "shortDays": ["일", "월", "화", "수", "목", "금", "토"], 8 | "months": ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], 9 | "shortMonths": ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/mk-MK.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e %B %Y г. %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["недела", "понеделник", "вторник", "среда", "четврток", "петок", "сабота"], 7 | "shortDays": ["нед", "пон", "вто", "сре", "чет", "пет", "саб"], 8 | "months": ["јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"], 9 | "shortMonths": ["јан", "фев", "мар", "апр", "мај", "јун", "јул", "авг", "сеп", "окт", "ное", "дек"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/nb-NO.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A den %d. %B %Y %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], 7 | "shortDays": ["søn", "man", "tir", "ons", "tor", "fre", "lør"], 8 | "months": ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], 9 | "shortMonths": ["jan", "feb", "mars", "apr", "mai", "juni", "juli", "aug", "sep", "okt", "nov", "des"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/nl-BE.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %e %B %Y %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], 7 | "shortDays": ["zo", "ma", "di", "wo", "do", "vr", "za"], 8 | "months": ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], 9 | "shortMonths": ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/nl-NL.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %e %B %Y %X", 3 | "date": "%d-%m-%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], 7 | "shortDays": ["zo", "ma", "di", "wo", "do", "vr", "za"], 8 | "months": ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], 9 | "shortMonths": ["jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/pl-PL.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e %B %Y, %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"], 7 | "shortDays": ["Niedz.", "Pon.", "Wt.", "Śr.", "Czw.", "Pt.", "Sob."], 8 | "months": ["Styczeń", "Luty", "Marzec", "Kwiecień", "Maj", "Czerwiec", "Lipiec", "Sierpień", "Wrzesień", "Październik", "Listopad", "Grudzień"], 9 | "shortMonths": ["Stycz.", "Luty", "Marz.", "Kwie.", "Maj", "Czerw.", "Lipc.", "Sierp.", "Wrz.", "Paźdz.", "Listop.", "Grudz."] 10 | } 11 | -------------------------------------------------------------------------------- /locale/pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e de %B de %Y. %X", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"], 7 | "shortDays": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], 8 | "months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], 9 | "shortMonths": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/ru-RU.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e %B %Y г. %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], 7 | "shortDays": ["вс", "пн", "вт", "ср", "чт", "пт", "сб"], 8 | "months": ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], 9 | "shortMonths": ["янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/sv-SE.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A den %d %B %Y %X", 3 | "date": "%Y-%m-%d", 4 | "time": "%H:%M:%S", 5 | "periods": ["fm", "em"], 6 | "days": ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"], 7 | "shortDays": ["Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"], 8 | "months": ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"], 9 | "shortMonths": ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/tr-TR.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a %e %b %X %Y", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], 7 | "shortDays": ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"], 8 | "months": ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], 9 | "shortMonths": ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/uk-UA.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%A, %e %B %Y р. %X", 3 | "date": "%d.%m.%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["дп", "пп"], 6 | "days": ["неділя", "понеділок", "вівторок", "середа", "четвер", "п'ятниця", "субота"], 7 | "shortDays": ["нд", "пн", "вт", "ср", "чт", "пт", "сб"], 8 | "months": ["січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"], 9 | "shortMonths": ["січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд."] 10 | } 11 | -------------------------------------------------------------------------------- /locale/vi-VN.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%a, %e %b, %Y %H:%M", 3 | "date": "%d/%m/%Y", 4 | "time": "%H:%M:%S", 5 | "periods": ["AM", "PM"], 6 | "days": ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"], 7 | "shortDays": ["CN", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"], 8 | "months": ["Tháng một", "Tháng hai", "Tháng ba", "Tháng tư", "Tháng năm", "Tháng sáu", "Tháng bảy", "Tháng tám", "Tháng chín", "Tháng mười", "Tháng mười một", "Tháng mười hai"], 9 | "shortMonths": ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x %A %X", 3 | "date": "%Y年%-m月%-d日", 4 | "time": "%H:%M:%S", 5 | "periods": ["上午", "下午"], 6 | "days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], 7 | "shortDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], 8 | "months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 9 | "shortMonths": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] 10 | } 11 | -------------------------------------------------------------------------------- /locale/zh-TW.json: -------------------------------------------------------------------------------- 1 | { 2 | "dateTime": "%x %A %X", 3 | "date": "%Y年%-m月%-d日", 4 | "time": "%H:%M:%S", 5 | "periods": ["上午", "下午"], 6 | "days": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], 7 | "shortDays": ["日", "一", "二", "三", "四", "五", "六"], 8 | "months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 9 | "shortMonths": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"] 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "d3-time-format", 3 | "version": "4.1.0", 4 | "description": "A JavaScript time formatter and parser inspired by strftime and strptime.", 5 | "homepage": "https://d3js.org/d3-time-format/", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/d3/d3-time-format.git" 9 | }, 10 | "keywords": [ 11 | "d3", 12 | "d3-module", 13 | "time", 14 | "format", 15 | "strftime", 16 | "strptime" 17 | ], 18 | "license": "ISC", 19 | "author": { 20 | "name": "Mike Bostock", 21 | "url": "http://bost.ocks.org/mike" 22 | }, 23 | "type": "module", 24 | "files": [ 25 | "dist/**/*.js", 26 | "src/**/*.js", 27 | "locale/*.json" 28 | ], 29 | "module": "src/index.js", 30 | "main": "src/index.js", 31 | "jsdelivr": "dist/d3-time-format.min.js", 32 | "unpkg": "dist/d3-time-format.min.js", 33 | "exports": { 34 | ".": { 35 | "umd": "./dist/d3-time-format.min.js", 36 | "default": "./src/index.js" 37 | }, 38 | "./locale/*": "./locale/*.json" 39 | }, 40 | "sideEffects": [ 41 | "./src/defaultLocale.js" 42 | ], 43 | "dependencies": { 44 | "d3-time": "1 - 3" 45 | }, 46 | "devDependencies": { 47 | "eslint": "8", 48 | "mocha": "9", 49 | "rollup": "2", 50 | "rollup-plugin-terser": "7" 51 | }, 52 | "scripts": { 53 | "test": "TZ=America/Los_Angeles mocha 'test/**/*-test.js' && eslint src test", 54 | "prepublishOnly": "rm -rf dist && yarn test && rollup -c", 55 | "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 -" 56 | }, 57 | "engines": { 58 | "node": ">=12" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import {readFileSync} from "fs"; 2 | import {terser} from "rollup-plugin-terser"; 3 | import * as meta from "./package.json"; 4 | 5 | // Extract copyrights from the LICENSE. 6 | const copyright = readFileSync("./LICENSE", "utf-8") 7 | .split(/\n/g) 8 | .filter(line => /^Copyright\s+/.test(line)) 9 | .map(line => line.replace(/^Copyright\s+/, "")) 10 | .join(", "); 11 | 12 | const config = { 13 | input: "src/index.js", 14 | external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), 15 | output: { 16 | file: `dist/${meta.name}.js`, 17 | name: "d3", 18 | format: "umd", 19 | indent: false, 20 | extend: true, 21 | banner: `// ${meta.homepage} v${meta.version} Copyright ${copyright}`, 22 | globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) 23 | }, 24 | plugins: [] 25 | }; 26 | 27 | export default [ 28 | config, 29 | { 30 | ...config, 31 | output: { 32 | ...config.output, 33 | file: `dist/${meta.name}.min.js` 34 | }, 35 | plugins: [ 36 | ...config.plugins, 37 | terser({ 38 | output: { 39 | preamble: config.output.banner 40 | } 41 | }) 42 | ] 43 | } 44 | ]; 45 | -------------------------------------------------------------------------------- /src/defaultLocale.js: -------------------------------------------------------------------------------- 1 | import formatLocale from "./locale.js"; 2 | 3 | var locale; 4 | export var timeFormat; 5 | export var timeParse; 6 | export var utcFormat; 7 | export var utcParse; 8 | 9 | defaultLocale({ 10 | dateTime: "%x, %X", 11 | date: "%-m/%-d/%Y", 12 | time: "%-I:%M:%S %p", 13 | periods: ["AM", "PM"], 14 | days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 15 | shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 16 | months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], 17 | shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 18 | }); 19 | 20 | export default function defaultLocale(definition) { 21 | locale = formatLocale(definition); 22 | timeFormat = locale.format; 23 | timeParse = locale.parse; 24 | utcFormat = locale.utcFormat; 25 | utcParse = locale.utcParse; 26 | return locale; 27 | } 28 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from "./defaultLocale.js"; 2 | export {default as timeFormatLocale} from "./locale.js"; 3 | export {default as isoFormat} from "./isoFormat.js"; 4 | export {default as isoParse} from "./isoParse.js"; 5 | -------------------------------------------------------------------------------- /src/isoFormat.js: -------------------------------------------------------------------------------- 1 | import {utcFormat} from "./defaultLocale.js"; 2 | 3 | export var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; 4 | 5 | function formatIsoNative(date) { 6 | return date.toISOString(); 7 | } 8 | 9 | var formatIso = Date.prototype.toISOString 10 | ? formatIsoNative 11 | : utcFormat(isoSpecifier); 12 | 13 | export default formatIso; 14 | -------------------------------------------------------------------------------- /src/isoParse.js: -------------------------------------------------------------------------------- 1 | import {isoSpecifier} from "./isoFormat.js"; 2 | import {utcParse} from "./defaultLocale.js"; 3 | 4 | function parseIsoNative(string) { 5 | var date = new Date(string); 6 | return isNaN(date) ? null : date; 7 | } 8 | 9 | var parseIso = +new Date("2000-01-01T00:00:00.000Z") 10 | ? parseIsoNative 11 | : utcParse(isoSpecifier); 12 | 13 | export default parseIso; 14 | -------------------------------------------------------------------------------- /src/locale.js: -------------------------------------------------------------------------------- 1 | import { 2 | timeDay, 3 | timeSunday, 4 | timeMonday, 5 | timeThursday, 6 | timeYear, 7 | utcDay, 8 | utcSunday, 9 | utcMonday, 10 | utcThursday, 11 | utcYear 12 | } from "d3-time"; 13 | 14 | function localDate(d) { 15 | if (0 <= d.y && d.y < 100) { 16 | var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); 17 | date.setFullYear(d.y); 18 | return date; 19 | } 20 | return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); 21 | } 22 | 23 | function utcDate(d) { 24 | if (0 <= d.y && d.y < 100) { 25 | var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); 26 | date.setUTCFullYear(d.y); 27 | return date; 28 | } 29 | return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); 30 | } 31 | 32 | function newDate(y, m, d) { 33 | return {y: y, m: m, d: d, H: 0, M: 0, S: 0, L: 0}; 34 | } 35 | 36 | export default function formatLocale(locale) { 37 | var locale_dateTime = locale.dateTime, 38 | locale_date = locale.date, 39 | locale_time = locale.time, 40 | locale_periods = locale.periods, 41 | locale_weekdays = locale.days, 42 | locale_shortWeekdays = locale.shortDays, 43 | locale_months = locale.months, 44 | locale_shortMonths = locale.shortMonths; 45 | 46 | var periodRe = formatRe(locale_periods), 47 | periodLookup = formatLookup(locale_periods), 48 | weekdayRe = formatRe(locale_weekdays), 49 | weekdayLookup = formatLookup(locale_weekdays), 50 | shortWeekdayRe = formatRe(locale_shortWeekdays), 51 | shortWeekdayLookup = formatLookup(locale_shortWeekdays), 52 | monthRe = formatRe(locale_months), 53 | monthLookup = formatLookup(locale_months), 54 | shortMonthRe = formatRe(locale_shortMonths), 55 | shortMonthLookup = formatLookup(locale_shortMonths); 56 | 57 | var formats = { 58 | "a": formatShortWeekday, 59 | "A": formatWeekday, 60 | "b": formatShortMonth, 61 | "B": formatMonth, 62 | "c": null, 63 | "d": formatDayOfMonth, 64 | "e": formatDayOfMonth, 65 | "f": formatMicroseconds, 66 | "g": formatYearISO, 67 | "G": formatFullYearISO, 68 | "H": formatHour24, 69 | "I": formatHour12, 70 | "j": formatDayOfYear, 71 | "L": formatMilliseconds, 72 | "m": formatMonthNumber, 73 | "M": formatMinutes, 74 | "p": formatPeriod, 75 | "q": formatQuarter, 76 | "Q": formatUnixTimestamp, 77 | "s": formatUnixTimestampSeconds, 78 | "S": formatSeconds, 79 | "u": formatWeekdayNumberMonday, 80 | "U": formatWeekNumberSunday, 81 | "V": formatWeekNumberISO, 82 | "w": formatWeekdayNumberSunday, 83 | "W": formatWeekNumberMonday, 84 | "x": null, 85 | "X": null, 86 | "y": formatYear, 87 | "Y": formatFullYear, 88 | "Z": formatZone, 89 | "%": formatLiteralPercent 90 | }; 91 | 92 | var utcFormats = { 93 | "a": formatUTCShortWeekday, 94 | "A": formatUTCWeekday, 95 | "b": formatUTCShortMonth, 96 | "B": formatUTCMonth, 97 | "c": null, 98 | "d": formatUTCDayOfMonth, 99 | "e": formatUTCDayOfMonth, 100 | "f": formatUTCMicroseconds, 101 | "g": formatUTCYearISO, 102 | "G": formatUTCFullYearISO, 103 | "H": formatUTCHour24, 104 | "I": formatUTCHour12, 105 | "j": formatUTCDayOfYear, 106 | "L": formatUTCMilliseconds, 107 | "m": formatUTCMonthNumber, 108 | "M": formatUTCMinutes, 109 | "p": formatUTCPeriod, 110 | "q": formatUTCQuarter, 111 | "Q": formatUnixTimestamp, 112 | "s": formatUnixTimestampSeconds, 113 | "S": formatUTCSeconds, 114 | "u": formatUTCWeekdayNumberMonday, 115 | "U": formatUTCWeekNumberSunday, 116 | "V": formatUTCWeekNumberISO, 117 | "w": formatUTCWeekdayNumberSunday, 118 | "W": formatUTCWeekNumberMonday, 119 | "x": null, 120 | "X": null, 121 | "y": formatUTCYear, 122 | "Y": formatUTCFullYear, 123 | "Z": formatUTCZone, 124 | "%": formatLiteralPercent 125 | }; 126 | 127 | var parses = { 128 | "a": parseShortWeekday, 129 | "A": parseWeekday, 130 | "b": parseShortMonth, 131 | "B": parseMonth, 132 | "c": parseLocaleDateTime, 133 | "d": parseDayOfMonth, 134 | "e": parseDayOfMonth, 135 | "f": parseMicroseconds, 136 | "g": parseYear, 137 | "G": parseFullYear, 138 | "H": parseHour24, 139 | "I": parseHour24, 140 | "j": parseDayOfYear, 141 | "L": parseMilliseconds, 142 | "m": parseMonthNumber, 143 | "M": parseMinutes, 144 | "p": parsePeriod, 145 | "q": parseQuarter, 146 | "Q": parseUnixTimestamp, 147 | "s": parseUnixTimestampSeconds, 148 | "S": parseSeconds, 149 | "u": parseWeekdayNumberMonday, 150 | "U": parseWeekNumberSunday, 151 | "V": parseWeekNumberISO, 152 | "w": parseWeekdayNumberSunday, 153 | "W": parseWeekNumberMonday, 154 | "x": parseLocaleDate, 155 | "X": parseLocaleTime, 156 | "y": parseYear, 157 | "Y": parseFullYear, 158 | "Z": parseZone, 159 | "%": parseLiteralPercent 160 | }; 161 | 162 | // These recursive directive definitions must be deferred. 163 | formats.x = newFormat(locale_date, formats); 164 | formats.X = newFormat(locale_time, formats); 165 | formats.c = newFormat(locale_dateTime, formats); 166 | utcFormats.x = newFormat(locale_date, utcFormats); 167 | utcFormats.X = newFormat(locale_time, utcFormats); 168 | utcFormats.c = newFormat(locale_dateTime, utcFormats); 169 | 170 | function newFormat(specifier, formats) { 171 | return function(date) { 172 | var string = [], 173 | i = -1, 174 | j = 0, 175 | n = specifier.length, 176 | c, 177 | pad, 178 | format; 179 | 180 | if (!(date instanceof Date)) date = new Date(+date); 181 | 182 | while (++i < n) { 183 | if (specifier.charCodeAt(i) === 37) { 184 | string.push(specifier.slice(j, i)); 185 | if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); 186 | else pad = c === "e" ? " " : "0"; 187 | if (format = formats[c]) c = format(date, pad); 188 | string.push(c); 189 | j = i + 1; 190 | } 191 | } 192 | 193 | string.push(specifier.slice(j, i)); 194 | return string.join(""); 195 | }; 196 | } 197 | 198 | function newParse(specifier, Z) { 199 | return function(string) { 200 | var d = newDate(1900, undefined, 1), 201 | i = parseSpecifier(d, specifier, string += "", 0), 202 | week, day; 203 | if (i != string.length) return null; 204 | 205 | // If a UNIX timestamp is specified, return it. 206 | if ("Q" in d) return new Date(d.Q); 207 | if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); 208 | 209 | // If this is utcParse, never use the local timezone. 210 | if (Z && !("Z" in d)) d.Z = 0; 211 | 212 | // The am-pm flag is 0 for AM, and 1 for PM. 213 | if ("p" in d) d.H = d.H % 12 + d.p * 12; 214 | 215 | // If the month was not specified, inherit from the quarter. 216 | if (d.m === undefined) d.m = "q" in d ? d.q : 0; 217 | 218 | // Convert day-of-week and week-of-year to day-of-year. 219 | if ("V" in d) { 220 | if (d.V < 1 || d.V > 53) return null; 221 | if (!("w" in d)) d.w = 1; 222 | if ("Z" in d) { 223 | week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); 224 | week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); 225 | week = utcDay.offset(week, (d.V - 1) * 7); 226 | d.y = week.getUTCFullYear(); 227 | d.m = week.getUTCMonth(); 228 | d.d = week.getUTCDate() + (d.w + 6) % 7; 229 | } else { 230 | week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); 231 | week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week); 232 | week = timeDay.offset(week, (d.V - 1) * 7); 233 | d.y = week.getFullYear(); 234 | d.m = week.getMonth(); 235 | d.d = week.getDate() + (d.w + 6) % 7; 236 | } 237 | } else if ("W" in d || "U" in d) { 238 | if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; 239 | day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); 240 | d.m = 0; 241 | d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; 242 | } 243 | 244 | // If a time zone is specified, all fields are interpreted as UTC and then 245 | // offset according to the specified time zone. 246 | if ("Z" in d) { 247 | d.H += d.Z / 100 | 0; 248 | d.M += d.Z % 100; 249 | return utcDate(d); 250 | } 251 | 252 | // Otherwise, all fields are in local time. 253 | return localDate(d); 254 | }; 255 | } 256 | 257 | function parseSpecifier(d, specifier, string, j) { 258 | var i = 0, 259 | n = specifier.length, 260 | m = string.length, 261 | c, 262 | parse; 263 | 264 | while (i < n) { 265 | if (j >= m) return -1; 266 | c = specifier.charCodeAt(i++); 267 | if (c === 37) { 268 | c = specifier.charAt(i++); 269 | parse = parses[c in pads ? specifier.charAt(i++) : c]; 270 | if (!parse || ((j = parse(d, string, j)) < 0)) return -1; 271 | } else if (c != string.charCodeAt(j++)) { 272 | return -1; 273 | } 274 | } 275 | 276 | return j; 277 | } 278 | 279 | function parsePeriod(d, string, i) { 280 | var n = periodRe.exec(string.slice(i)); 281 | return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 282 | } 283 | 284 | function parseShortWeekday(d, string, i) { 285 | var n = shortWeekdayRe.exec(string.slice(i)); 286 | return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 287 | } 288 | 289 | function parseWeekday(d, string, i) { 290 | var n = weekdayRe.exec(string.slice(i)); 291 | return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 292 | } 293 | 294 | function parseShortMonth(d, string, i) { 295 | var n = shortMonthRe.exec(string.slice(i)); 296 | return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 297 | } 298 | 299 | function parseMonth(d, string, i) { 300 | var n = monthRe.exec(string.slice(i)); 301 | return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; 302 | } 303 | 304 | function parseLocaleDateTime(d, string, i) { 305 | return parseSpecifier(d, locale_dateTime, string, i); 306 | } 307 | 308 | function parseLocaleDate(d, string, i) { 309 | return parseSpecifier(d, locale_date, string, i); 310 | } 311 | 312 | function parseLocaleTime(d, string, i) { 313 | return parseSpecifier(d, locale_time, string, i); 314 | } 315 | 316 | function formatShortWeekday(d) { 317 | return locale_shortWeekdays[d.getDay()]; 318 | } 319 | 320 | function formatWeekday(d) { 321 | return locale_weekdays[d.getDay()]; 322 | } 323 | 324 | function formatShortMonth(d) { 325 | return locale_shortMonths[d.getMonth()]; 326 | } 327 | 328 | function formatMonth(d) { 329 | return locale_months[d.getMonth()]; 330 | } 331 | 332 | function formatPeriod(d) { 333 | return locale_periods[+(d.getHours() >= 12)]; 334 | } 335 | 336 | function formatQuarter(d) { 337 | return 1 + ~~(d.getMonth() / 3); 338 | } 339 | 340 | function formatUTCShortWeekday(d) { 341 | return locale_shortWeekdays[d.getUTCDay()]; 342 | } 343 | 344 | function formatUTCWeekday(d) { 345 | return locale_weekdays[d.getUTCDay()]; 346 | } 347 | 348 | function formatUTCShortMonth(d) { 349 | return locale_shortMonths[d.getUTCMonth()]; 350 | } 351 | 352 | function formatUTCMonth(d) { 353 | return locale_months[d.getUTCMonth()]; 354 | } 355 | 356 | function formatUTCPeriod(d) { 357 | return locale_periods[+(d.getUTCHours() >= 12)]; 358 | } 359 | 360 | function formatUTCQuarter(d) { 361 | return 1 + ~~(d.getUTCMonth() / 3); 362 | } 363 | 364 | return { 365 | format: function(specifier) { 366 | var f = newFormat(specifier += "", formats); 367 | f.toString = function() { return specifier; }; 368 | return f; 369 | }, 370 | parse: function(specifier) { 371 | var p = newParse(specifier += "", false); 372 | p.toString = function() { return specifier; }; 373 | return p; 374 | }, 375 | utcFormat: function(specifier) { 376 | var f = newFormat(specifier += "", utcFormats); 377 | f.toString = function() { return specifier; }; 378 | return f; 379 | }, 380 | utcParse: function(specifier) { 381 | var p = newParse(specifier += "", true); 382 | p.toString = function() { return specifier; }; 383 | return p; 384 | } 385 | }; 386 | } 387 | 388 | var pads = {"-": "", "_": " ", "0": "0"}, 389 | numberRe = /^\s*\d+/, // note: ignores next directive 390 | percentRe = /^%/, 391 | requoteRe = /[\\^$*+?|[\]().{}]/g; 392 | 393 | function pad(value, fill, width) { 394 | var sign = value < 0 ? "-" : "", 395 | string = (sign ? -value : value) + "", 396 | length = string.length; 397 | return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); 398 | } 399 | 400 | function requote(s) { 401 | return s.replace(requoteRe, "\\$&"); 402 | } 403 | 404 | function formatRe(names) { 405 | return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); 406 | } 407 | 408 | function formatLookup(names) { 409 | return new Map(names.map((name, i) => [name.toLowerCase(), i])); 410 | } 411 | 412 | function parseWeekdayNumberSunday(d, string, i) { 413 | var n = numberRe.exec(string.slice(i, i + 1)); 414 | return n ? (d.w = +n[0], i + n[0].length) : -1; 415 | } 416 | 417 | function parseWeekdayNumberMonday(d, string, i) { 418 | var n = numberRe.exec(string.slice(i, i + 1)); 419 | return n ? (d.u = +n[0], i + n[0].length) : -1; 420 | } 421 | 422 | function parseWeekNumberSunday(d, string, i) { 423 | var n = numberRe.exec(string.slice(i, i + 2)); 424 | return n ? (d.U = +n[0], i + n[0].length) : -1; 425 | } 426 | 427 | function parseWeekNumberISO(d, string, i) { 428 | var n = numberRe.exec(string.slice(i, i + 2)); 429 | return n ? (d.V = +n[0], i + n[0].length) : -1; 430 | } 431 | 432 | function parseWeekNumberMonday(d, string, i) { 433 | var n = numberRe.exec(string.slice(i, i + 2)); 434 | return n ? (d.W = +n[0], i + n[0].length) : -1; 435 | } 436 | 437 | function parseFullYear(d, string, i) { 438 | var n = numberRe.exec(string.slice(i, i + 4)); 439 | return n ? (d.y = +n[0], i + n[0].length) : -1; 440 | } 441 | 442 | function parseYear(d, string, i) { 443 | var n = numberRe.exec(string.slice(i, i + 2)); 444 | return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; 445 | } 446 | 447 | function parseZone(d, string, i) { 448 | var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); 449 | return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; 450 | } 451 | 452 | function parseQuarter(d, string, i) { 453 | var n = numberRe.exec(string.slice(i, i + 1)); 454 | return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; 455 | } 456 | 457 | function parseMonthNumber(d, string, i) { 458 | var n = numberRe.exec(string.slice(i, i + 2)); 459 | return n ? (d.m = n[0] - 1, i + n[0].length) : -1; 460 | } 461 | 462 | function parseDayOfMonth(d, string, i) { 463 | var n = numberRe.exec(string.slice(i, i + 2)); 464 | return n ? (d.d = +n[0], i + n[0].length) : -1; 465 | } 466 | 467 | function parseDayOfYear(d, string, i) { 468 | var n = numberRe.exec(string.slice(i, i + 3)); 469 | return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; 470 | } 471 | 472 | function parseHour24(d, string, i) { 473 | var n = numberRe.exec(string.slice(i, i + 2)); 474 | return n ? (d.H = +n[0], i + n[0].length) : -1; 475 | } 476 | 477 | function parseMinutes(d, string, i) { 478 | var n = numberRe.exec(string.slice(i, i + 2)); 479 | return n ? (d.M = +n[0], i + n[0].length) : -1; 480 | } 481 | 482 | function parseSeconds(d, string, i) { 483 | var n = numberRe.exec(string.slice(i, i + 2)); 484 | return n ? (d.S = +n[0], i + n[0].length) : -1; 485 | } 486 | 487 | function parseMilliseconds(d, string, i) { 488 | var n = numberRe.exec(string.slice(i, i + 3)); 489 | return n ? (d.L = +n[0], i + n[0].length) : -1; 490 | } 491 | 492 | function parseMicroseconds(d, string, i) { 493 | var n = numberRe.exec(string.slice(i, i + 6)); 494 | return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; 495 | } 496 | 497 | function parseLiteralPercent(d, string, i) { 498 | var n = percentRe.exec(string.slice(i, i + 1)); 499 | return n ? i + n[0].length : -1; 500 | } 501 | 502 | function parseUnixTimestamp(d, string, i) { 503 | var n = numberRe.exec(string.slice(i)); 504 | return n ? (d.Q = +n[0], i + n[0].length) : -1; 505 | } 506 | 507 | function parseUnixTimestampSeconds(d, string, i) { 508 | var n = numberRe.exec(string.slice(i)); 509 | return n ? (d.s = +n[0], i + n[0].length) : -1; 510 | } 511 | 512 | function formatDayOfMonth(d, p) { 513 | return pad(d.getDate(), p, 2); 514 | } 515 | 516 | function formatHour24(d, p) { 517 | return pad(d.getHours(), p, 2); 518 | } 519 | 520 | function formatHour12(d, p) { 521 | return pad(d.getHours() % 12 || 12, p, 2); 522 | } 523 | 524 | function formatDayOfYear(d, p) { 525 | return pad(1 + timeDay.count(timeYear(d), d), p, 3); 526 | } 527 | 528 | function formatMilliseconds(d, p) { 529 | return pad(d.getMilliseconds(), p, 3); 530 | } 531 | 532 | function formatMicroseconds(d, p) { 533 | return formatMilliseconds(d, p) + "000"; 534 | } 535 | 536 | function formatMonthNumber(d, p) { 537 | return pad(d.getMonth() + 1, p, 2); 538 | } 539 | 540 | function formatMinutes(d, p) { 541 | return pad(d.getMinutes(), p, 2); 542 | } 543 | 544 | function formatSeconds(d, p) { 545 | return pad(d.getSeconds(), p, 2); 546 | } 547 | 548 | function formatWeekdayNumberMonday(d) { 549 | var day = d.getDay(); 550 | return day === 0 ? 7 : day; 551 | } 552 | 553 | function formatWeekNumberSunday(d, p) { 554 | return pad(timeSunday.count(timeYear(d) - 1, d), p, 2); 555 | } 556 | 557 | function dISO(d) { 558 | var day = d.getDay(); 559 | return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d); 560 | } 561 | 562 | function formatWeekNumberISO(d, p) { 563 | d = dISO(d); 564 | return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); 565 | } 566 | 567 | function formatWeekdayNumberSunday(d) { 568 | return d.getDay(); 569 | } 570 | 571 | function formatWeekNumberMonday(d, p) { 572 | return pad(timeMonday.count(timeYear(d) - 1, d), p, 2); 573 | } 574 | 575 | function formatYear(d, p) { 576 | return pad(d.getFullYear() % 100, p, 2); 577 | } 578 | 579 | function formatYearISO(d, p) { 580 | d = dISO(d); 581 | return pad(d.getFullYear() % 100, p, 2); 582 | } 583 | 584 | function formatFullYear(d, p) { 585 | return pad(d.getFullYear() % 10000, p, 4); 586 | } 587 | 588 | function formatFullYearISO(d, p) { 589 | var day = d.getDay(); 590 | d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d); 591 | return pad(d.getFullYear() % 10000, p, 4); 592 | } 593 | 594 | function formatZone(d) { 595 | var z = d.getTimezoneOffset(); 596 | return (z > 0 ? "-" : (z *= -1, "+")) 597 | + pad(z / 60 | 0, "0", 2) 598 | + pad(z % 60, "0", 2); 599 | } 600 | 601 | function formatUTCDayOfMonth(d, p) { 602 | return pad(d.getUTCDate(), p, 2); 603 | } 604 | 605 | function formatUTCHour24(d, p) { 606 | return pad(d.getUTCHours(), p, 2); 607 | } 608 | 609 | function formatUTCHour12(d, p) { 610 | return pad(d.getUTCHours() % 12 || 12, p, 2); 611 | } 612 | 613 | function formatUTCDayOfYear(d, p) { 614 | return pad(1 + utcDay.count(utcYear(d), d), p, 3); 615 | } 616 | 617 | function formatUTCMilliseconds(d, p) { 618 | return pad(d.getUTCMilliseconds(), p, 3); 619 | } 620 | 621 | function formatUTCMicroseconds(d, p) { 622 | return formatUTCMilliseconds(d, p) + "000"; 623 | } 624 | 625 | function formatUTCMonthNumber(d, p) { 626 | return pad(d.getUTCMonth() + 1, p, 2); 627 | } 628 | 629 | function formatUTCMinutes(d, p) { 630 | return pad(d.getUTCMinutes(), p, 2); 631 | } 632 | 633 | function formatUTCSeconds(d, p) { 634 | return pad(d.getUTCSeconds(), p, 2); 635 | } 636 | 637 | function formatUTCWeekdayNumberMonday(d) { 638 | var dow = d.getUTCDay(); 639 | return dow === 0 ? 7 : dow; 640 | } 641 | 642 | function formatUTCWeekNumberSunday(d, p) { 643 | return pad(utcSunday.count(utcYear(d) - 1, d), p, 2); 644 | } 645 | 646 | function UTCdISO(d) { 647 | var day = d.getUTCDay(); 648 | return (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d); 649 | } 650 | 651 | function formatUTCWeekNumberISO(d, p) { 652 | d = UTCdISO(d); 653 | return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); 654 | } 655 | 656 | function formatUTCWeekdayNumberSunday(d) { 657 | return d.getUTCDay(); 658 | } 659 | 660 | function formatUTCWeekNumberMonday(d, p) { 661 | return pad(utcMonday.count(utcYear(d) - 1, d), p, 2); 662 | } 663 | 664 | function formatUTCYear(d, p) { 665 | return pad(d.getUTCFullYear() % 100, p, 2); 666 | } 667 | 668 | function formatUTCYearISO(d, p) { 669 | d = UTCdISO(d); 670 | return pad(d.getUTCFullYear() % 100, p, 2); 671 | } 672 | 673 | function formatUTCFullYear(d, p) { 674 | return pad(d.getUTCFullYear() % 10000, p, 4); 675 | } 676 | 677 | function formatUTCFullYearISO(d, p) { 678 | var day = d.getUTCDay(); 679 | d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d); 680 | return pad(d.getUTCFullYear() % 10000, p, 4); 681 | } 682 | 683 | function formatUTCZone() { 684 | return "+0000"; 685 | } 686 | 687 | function formatLiteralPercent() { 688 | return "%"; 689 | } 690 | 691 | function formatUnixTimestamp(d) { 692 | return +d; 693 | } 694 | 695 | function formatUnixTimestampSeconds(d) { 696 | return Math.floor(+d / 1000); 697 | } 698 | -------------------------------------------------------------------------------- /test/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "parserOptions": { 4 | "sourceType": "module", 5 | "ecmaVersion": 8 6 | }, 7 | "env": { 8 | "es6": true, 9 | "mocha": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/date.js: -------------------------------------------------------------------------------- 1 | export function local(year, month, day, hours, minutes, seconds, milliseconds) { 2 | if (year == null) year = 0; 3 | if (month == null) month = 0; 4 | if (day == null) day = 1; 5 | if (hours == null) hours = 0; 6 | if (minutes == null) minutes = 0; 7 | if (seconds == null) seconds = 0; 8 | if (milliseconds == null) milliseconds = 0; 9 | if (0 <= year && year < 100) { 10 | const date = new Date(-1, month, day, hours, minutes, seconds, milliseconds); 11 | date.setFullYear(year); 12 | return date; 13 | } 14 | return new Date(year, month, day, hours, minutes, seconds, milliseconds); 15 | } 16 | 17 | export function utc(year, month, day, hours, minutes, seconds, milliseconds) { 18 | if (year == null) year = 0; 19 | if (month == null) month = 0; 20 | if (day == null) day = 1; 21 | if (hours == null) hours = 0; 22 | if (minutes == null) minutes = 0; 23 | if (seconds == null) seconds = 0; 24 | if (milliseconds == null) milliseconds = 0; 25 | if (0 <= year && year < 100) { 26 | const date = new Date(Date.UTC(-1, month, day, hours, minutes, seconds, milliseconds)); 27 | date.setUTCFullYear(year); 28 | return date; 29 | } 30 | return new Date(Date.UTC(year, month, day, hours, minutes, seconds, milliseconds)); 31 | } 32 | -------------------------------------------------------------------------------- /test/defaultLocale-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {readFileSync} from "fs"; 3 | import {timeFormat, timeFormatDefaultLocale, timeParse, utcFormat, utcParse} from "../src/index.js"; 4 | 5 | const enUs = JSON.parse(readFileSync("./locale/en-US.json")); 6 | const frFr = JSON.parse(readFileSync("./locale/fr-FR.json")); 7 | 8 | it("timeFormat(specifier) defaults to en-US", () => { 9 | assert.strictEqual(timeFormat("%c")(new Date(2000, 0, 1)), "1/1/2000, 12:00:00 AM"); 10 | }); 11 | 12 | it("timeParse(specifier) defaults to en-US", () => { 13 | assert.strictEqual(+timeParse("%c")("1/1/2000, 12:00:00 AM"), +new Date(2000, 0, 1)); 14 | }); 15 | 16 | it("utcFormat(specifier) defaults to en-US", () => { 17 | assert.strictEqual(utcFormat("%c")(new Date(Date.UTC(2000, 0, 1))), "1/1/2000, 12:00:00 AM"); 18 | }); 19 | 20 | it("utcParse(specifier) defaults to en-US", () => { 21 | assert.strictEqual(+utcParse("%c")("1/1/2000, 12:00:00 AM"), +new Date(Date.UTC(2000, 0, 1))); 22 | }); 23 | 24 | it("timeFormatDefaultLocale(definition) returns the new default locale", () => { 25 | const locale = timeFormatDefaultLocale(frFr); 26 | try { 27 | assert.strictEqual(locale.format("%c")(new Date(2000, 0, 1)), "samedi 1 janvier 2000 à 00:00:00"); 28 | } finally { 29 | timeFormatDefaultLocale(enUs); 30 | } 31 | }); 32 | 33 | it("timeFormatDefaultLocale(definition) affects timeFormat", () => { 34 | const locale = timeFormatDefaultLocale(frFr); 35 | try { 36 | assert.strictEqual(timeFormat, locale.format); 37 | assert.strictEqual(timeFormat("%c")(new Date(2000, 0, 1)), "samedi 1 janvier 2000 à 00:00:00"); 38 | } finally { 39 | timeFormatDefaultLocale(enUs); 40 | } 41 | }); 42 | 43 | it("timeFormatDefaultLocale(definition) affects timeParse", () => { 44 | const locale = timeFormatDefaultLocale(frFr); 45 | try { 46 | assert.strictEqual(timeParse, locale.parse); 47 | assert.strictEqual(+timeParse("%c")("samedi 1 janvier 2000 à 00:00:00"), +new Date(2000, 0, 1)); 48 | } finally { 49 | timeFormatDefaultLocale(enUs); 50 | } 51 | }); 52 | 53 | it("timeFormatDefaultLocale(definition) affects utcFormat", () => { 54 | const locale = timeFormatDefaultLocale(frFr); 55 | try { 56 | assert.strictEqual(utcFormat, locale.utcFormat); 57 | assert.strictEqual(utcFormat("%c")(new Date(Date.UTC(2000, 0, 1))), "samedi 1 janvier 2000 à 00:00:00"); 58 | } finally { 59 | timeFormatDefaultLocale(enUs); 60 | } 61 | }); 62 | 63 | it("timeFormatDefaultLocale(definition) affects utcParse", () => { 64 | const locale = timeFormatDefaultLocale(frFr); 65 | try { 66 | assert.strictEqual(utcParse, locale.utcParse); 67 | assert.strictEqual(+utcParse("%c")("samedi 1 janvier 2000 à 00:00:00"), +new Date(Date.UTC(2000, 0, 1))); 68 | } finally { 69 | timeFormatDefaultLocale(enUs); 70 | } 71 | }); 72 | -------------------------------------------------------------------------------- /test/format-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {timeSecond, timeMinute, timeHour, timeDay, timeMonth, timeWeek, timeYear} from "d3-time"; 3 | import {timeFormat} from "../src/index.js"; 4 | import {local} from "./date.js"; 5 | 6 | const formatMillisecond = timeFormat(".%L"), 7 | formatSecond = timeFormat(":%S"), 8 | formatMinute = timeFormat("%I:%M"), 9 | formatHour = timeFormat("%I %p"), 10 | formatDay = timeFormat("%a %d"), 11 | formatWeek = timeFormat("%b %d"), 12 | formatMonth = timeFormat("%B"), 13 | formatYear = timeFormat("%Y"); 14 | 15 | function multi(d) { 16 | return (timeSecond(d) < d ? formatMillisecond 17 | : timeMinute(d) < d ? formatSecond 18 | : timeHour(d) < d ? formatMinute 19 | : timeDay(d) < d ? formatHour 20 | : timeMonth(d) < d ? (timeWeek(d) < d ? formatDay : formatWeek) 21 | : timeYear(d) < d ? formatMonth 22 | : formatYear)(d); 23 | } 24 | 25 | it("timeFormat(date) coerces the specified date to a Date", () => { 26 | const f = timeFormat("%c"); 27 | assert.strictEqual(f(+local(1990, 0, 1)), "1/1/1990, 12:00:00 AM"); 28 | assert.strictEqual(f(+local(1990, 0, 2)), "1/2/1990, 12:00:00 AM"); 29 | assert.strictEqual(f(+local(1990, 0, 3)), "1/3/1990, 12:00:00 AM"); 30 | assert.strictEqual(f(+local(1990, 0, 4)), "1/4/1990, 12:00:00 AM"); 31 | assert.strictEqual(f(+local(1990, 0, 5)), "1/5/1990, 12:00:00 AM"); 32 | assert.strictEqual(f(+local(1990, 0, 6)), "1/6/1990, 12:00:00 AM"); 33 | assert.strictEqual(f(+local(1990, 0, 7)), "1/7/1990, 12:00:00 AM"); 34 | }); 35 | 36 | it("timeFormat(\"%a\")(date) formats abbreviated weekdays", () => { 37 | const f = timeFormat("%a"); 38 | assert.strictEqual(f(local(1990, 0, 1)), "Mon"); 39 | assert.strictEqual(f(local(1990, 0, 2)), "Tue"); 40 | assert.strictEqual(f(local(1990, 0, 3)), "Wed"); 41 | assert.strictEqual(f(local(1990, 0, 4)), "Thu"); 42 | assert.strictEqual(f(local(1990, 0, 5)), "Fri"); 43 | assert.strictEqual(f(local(1990, 0, 6)), "Sat"); 44 | assert.strictEqual(f(local(1990, 0, 7)), "Sun"); 45 | }); 46 | 47 | it("timeFormat(\"%A\")(date) formats weekdays", () => { 48 | const f = timeFormat("%A"); 49 | assert.strictEqual(f(local(1990, 0, 1)), "Monday"); 50 | assert.strictEqual(f(local(1990, 0, 2)), "Tuesday"); 51 | assert.strictEqual(f(local(1990, 0, 3)), "Wednesday"); 52 | assert.strictEqual(f(local(1990, 0, 4)), "Thursday"); 53 | assert.strictEqual(f(local(1990, 0, 5)), "Friday"); 54 | assert.strictEqual(f(local(1990, 0, 6)), "Saturday"); 55 | assert.strictEqual(f(local(1990, 0, 7)), "Sunday"); 56 | }); 57 | 58 | it("timeFormat(\"%b\")(date) formats abbreviated months", () => { 59 | const f = timeFormat("%b"); 60 | assert.strictEqual(f(local(1990, 0, 1)), "Jan"); 61 | assert.strictEqual(f(local(1990, 1, 1)), "Feb"); 62 | assert.strictEqual(f(local(1990, 2, 1)), "Mar"); 63 | assert.strictEqual(f(local(1990, 3, 1)), "Apr"); 64 | assert.strictEqual(f(local(1990, 4, 1)), "May"); 65 | assert.strictEqual(f(local(1990, 5, 1)), "Jun"); 66 | assert.strictEqual(f(local(1990, 6, 1)), "Jul"); 67 | assert.strictEqual(f(local(1990, 7, 1)), "Aug"); 68 | assert.strictEqual(f(local(1990, 8, 1)), "Sep"); 69 | assert.strictEqual(f(local(1990, 9, 1)), "Oct"); 70 | assert.strictEqual(f(local(1990, 10, 1)), "Nov"); 71 | assert.strictEqual(f(local(1990, 11, 1)), "Dec"); 72 | }); 73 | 74 | it("timeFormat(\"%B\")(date) formats months", () => { 75 | const f = timeFormat("%B"); 76 | assert.strictEqual(f(local(1990, 0, 1)), "January"); 77 | assert.strictEqual(f(local(1990, 1, 1)), "February"); 78 | assert.strictEqual(f(local(1990, 2, 1)), "March"); 79 | assert.strictEqual(f(local(1990, 3, 1)), "April"); 80 | assert.strictEqual(f(local(1990, 4, 1)), "May"); 81 | assert.strictEqual(f(local(1990, 5, 1)), "June"); 82 | assert.strictEqual(f(local(1990, 6, 1)), "July"); 83 | assert.strictEqual(f(local(1990, 7, 1)), "August"); 84 | assert.strictEqual(f(local(1990, 8, 1)), "September"); 85 | assert.strictEqual(f(local(1990, 9, 1)), "October"); 86 | assert.strictEqual(f(local(1990, 10, 1)), "November"); 87 | assert.strictEqual(f(local(1990, 11, 1)), "December"); 88 | }); 89 | 90 | it("timeFormat(\"%c\")(date) formats localized dates and times", () => { 91 | const f = timeFormat("%c"); 92 | assert.strictEqual(f(local(1990, 0, 1)), "1/1/1990, 12:00:00 AM"); 93 | }); 94 | 95 | it("timeFormat(\"%d\")(date) formats zero-padded dates", () => { 96 | const f = timeFormat("%d"); 97 | assert.strictEqual(f(local(1990, 0, 1)), "01"); 98 | }); 99 | 100 | it("timeFormat(\"%e\")(date) formats space-padded dates", () => { 101 | const f = timeFormat("%e"); 102 | assert.strictEqual(f(local(1990, 0, 1)), " 1"); 103 | }); 104 | 105 | it("timeFormat(\"%g\")(date) formats zero-padded two-digit ISO 8601 years", () => { 106 | const f = timeFormat("%g"); 107 | assert.strictEqual(f(local(2018, 11, 30, 0)), "18"); // Sunday 108 | assert.strictEqual(f(local(2018, 11, 31, 0)), "19"); // Monday 109 | assert.strictEqual(f(local(2019, 0, 1, 0)), "19"); 110 | }); 111 | 112 | it("timeFormat(\"%G\")(date) formats zero-padded four-digit ISO 8601 years", () => { 113 | const f = timeFormat("%G"); 114 | assert.strictEqual(f(local(2018, 11, 30, 0)), "2018"); // Sunday 115 | assert.strictEqual(f(local(2018, 11, 31, 0)), "2019"); // Monday 116 | assert.strictEqual(f(local(2019, 0, 1, 0)), "2019"); 117 | }); 118 | 119 | it("timeFormat(\"%H\")(date) formats zero-padded hours (24)", () => { 120 | const f = timeFormat("%H"); 121 | assert.strictEqual(f(local(1990, 0, 1, 0)), "00"); 122 | assert.strictEqual(f(local(1990, 0, 1, 13)), "13"); 123 | }); 124 | 125 | it("timeFormat(\"%I\")(date) formats zero-padded hours (12)", () => { 126 | const f = timeFormat("%I"); 127 | assert.strictEqual(f(local(1990, 0, 1, 0)), "12"); 128 | assert.strictEqual(f(local(1990, 0, 1, 13)), "01"); 129 | }); 130 | 131 | it("timeFormat(\"%j\")(date) formats zero-padded day of year numbers", () => { 132 | const f = timeFormat("%j"); 133 | assert.strictEqual(f(local(1990, 0, 1)), "001"); 134 | assert.strictEqual(f(local(1990, 5, 1)), "152"); 135 | assert.strictEqual(f(local(2010, 2, 13)), "072"); 136 | assert.strictEqual(f(local(2010, 2, 14)), "073"); // DST begins 137 | assert.strictEqual(f(local(2010, 2, 15)), "074"); 138 | assert.strictEqual(f(local(2010, 10, 6)), "310"); 139 | assert.strictEqual(f(local(2010, 10, 7)), "311"); // DST ends 140 | assert.strictEqual(f(local(2010, 10, 8)), "312"); 141 | }); 142 | 143 | it("timeFormat(\"%m\")(date) formats zero-padded months", () => { 144 | const f = timeFormat("%m"); 145 | assert.strictEqual(f(local(1990, 0, 1)), "01"); 146 | assert.strictEqual(f(local(1990, 9, 1)), "10"); 147 | }); 148 | 149 | it("timeFormat(\"%M\")(date) formats zero-padded minutes", () => { 150 | const f = timeFormat("%M"); 151 | assert.strictEqual(f(local(1990, 0, 1, 0, 0)), "00"); 152 | assert.strictEqual(f(local(1990, 0, 1, 0, 32)), "32"); 153 | }); 154 | 155 | it("timeFormat(\"%p\")(date) formats AM or PM", () => { 156 | const f = timeFormat("%p"); 157 | assert.strictEqual(f(local(1990, 0, 1, 0)), "AM"); 158 | assert.strictEqual(f(local(1990, 0, 1, 13)), "PM"); 159 | }); 160 | 161 | it("timeFormat(\"%q\")(date) formats quarters", () => { 162 | const f = timeFormat("%q"); 163 | assert.strictEqual(f(local(1990, 0, 1)), "1"); 164 | assert.strictEqual(f(local(1990, 3, 1)), "2"); 165 | assert.strictEqual(f(local(1990, 6, 1)), "3"); 166 | assert.strictEqual(f(local(1990, 9, 1)), "4"); 167 | }); 168 | 169 | it("timeFormat(\"%S\")(date) formats zero-padded seconds", () => { 170 | const f = timeFormat("%S"); 171 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0)), "00"); 172 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 32)), "32"); 173 | const f2 = timeFormat("%0S"); 174 | assert.strictEqual(f2(local(1990, 0, 1, 0, 0, 0)), "00"); 175 | assert.strictEqual(f2(local(1990, 0, 1, 0, 0, 32)), "32"); 176 | }); 177 | 178 | it("timeFormat(\"%_S\")(date) formats space-padded seconds", () => { 179 | const f = timeFormat("%_S"); 180 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0)), " 0"); 181 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 3)), " 3"); 182 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 32)), "32"); 183 | }); 184 | 185 | it("timeFormat(\"-S\")(date) formats no-padded seconds", () => { 186 | const f = timeFormat("%-S"); 187 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0)), "0"); 188 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 3)), "3"); 189 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 32)), "32"); 190 | }); 191 | 192 | it("timeFormat(\"%L\")(date) formats zero-padded milliseconds", () => { 193 | const f = timeFormat("%L"); 194 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0, 0)), "000"); 195 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0, 432)), "432"); 196 | }); 197 | 198 | it("timeFormat(\"%u\")(date) formats week day numbers", () => { 199 | const f = timeFormat("%u"); 200 | assert.strictEqual(f(local(1990, 0, 1, 0)), "1"); 201 | assert.strictEqual(f(local(1990, 0, 7, 0)), "7"); 202 | assert.strictEqual(f(local(2010, 2, 13, 23)), "6"); 203 | }); 204 | 205 | it("timeFormat(\"%f\")(date) formats zero-padded microseconds", () => { 206 | const f = timeFormat("%f"); 207 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0, 0)), "000000"); 208 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0, 432)), "432000"); 209 | }); 210 | 211 | it("timeFormat(\"%U\")(date) formats zero-padded week numbers", () => { 212 | const f = timeFormat("%U"); 213 | assert.strictEqual(f(local(1990, 0, 1, 0)), "00"); 214 | assert.strictEqual(f(local(1990, 5, 1, 0)), "21"); 215 | assert.strictEqual(f(local(2010, 2, 13, 23)), "10"); 216 | assert.strictEqual(f(local(2010, 2, 14, 0)), "11"); // DST begins 217 | assert.strictEqual(f(local(2010, 2, 15, 0)), "11"); 218 | assert.strictEqual(f(local(2010, 10, 6, 23)), "44"); 219 | assert.strictEqual(f(local(2010, 10, 7, 0)), "45"); // DST ends 220 | assert.strictEqual(f(local(2010, 10, 8, 0)), "45"); 221 | assert.strictEqual(f(local(2012, 0, 1, 0)), "01"); // Sunday! 222 | }); 223 | 224 | it("timeFormat(\"%W\")(date) formats zero-padded week numbers", () => { 225 | const f = timeFormat("%W"); 226 | assert.strictEqual(f(local(1990, 0, 1, 0)), "01"); // Monday! 227 | assert.strictEqual(f(local(1990, 5, 1, 0)), "22"); 228 | assert.strictEqual(f(local(2010, 2, 15, 0)), "11"); 229 | assert.strictEqual(f(local(2010, 10, 8, 0)), "45"); 230 | }); 231 | 232 | it("timeFormat(\"%V\")(date) formats zero-padded ISO 8601 week numbers", () => { 233 | const f = timeFormat("%V"); 234 | assert.strictEqual(f(local(1990, 0, 1, 0)), "01"); 235 | assert.strictEqual(f(local(1990, 5, 1, 0)), "22"); 236 | assert.strictEqual(f(local(2010, 2, 13, 23)), "10"); 237 | assert.strictEqual(f(local(2010, 2, 14, 0)), "10"); // DST begins 238 | assert.strictEqual(f(local(2010, 2, 15, 0)), "11"); 239 | assert.strictEqual(f(local(2010, 10, 6, 23)), "44"); 240 | assert.strictEqual(f(local(2010, 10, 7, 0)), "44"); // DST ends 241 | assert.strictEqual(f(local(2010, 10, 8, 0)), "45"); 242 | assert.strictEqual(f(local(2015, 11, 31, 0)), "53"); 243 | assert.strictEqual(f(local(2016, 0, 1, 0)), "53"); 244 | }); 245 | 246 | it("timeFormat(\"%x\")(date) formats localized dates", () => { 247 | const f = timeFormat("%x"); 248 | assert.strictEqual(f(local(1990, 0, 1)), "1/1/1990"); 249 | assert.strictEqual(f(local(2010, 5, 1)), "6/1/2010"); 250 | }); 251 | 252 | it("timeFormat(\"%X\")(date) formats localized times", () => { 253 | const f = timeFormat("%X"); 254 | assert.strictEqual(f(local(1990, 0, 1, 0, 0, 0)), "12:00:00 AM"); 255 | assert.strictEqual(f(local(1990, 0, 1, 13, 34, 59)), "1:34:59 PM"); 256 | }); 257 | 258 | it("timeFormat(\"%y\")(date) formats zero-padded two-digit years", () => { 259 | const f = timeFormat("%y"); 260 | assert.strictEqual(f(local(+1990, 0, 1)), "90"); 261 | assert.strictEqual(f(local(+2002, 0, 1)), "02"); 262 | assert.strictEqual(f(local(-2, 0, 1)), "-02"); 263 | }); 264 | 265 | it("timeFormat(\"%Y\")(date) formats zero-padded four-digit years", () => { 266 | const f = timeFormat("%Y"); 267 | assert.strictEqual(f(local( 123, 0, 1)), "0123"); 268 | assert.strictEqual(f(local( 1990, 0, 1)), "1990"); 269 | assert.strictEqual(f(local( 2002, 0, 1)), "2002"); 270 | assert.strictEqual(f(local(10002, 0, 1)), "0002"); 271 | assert.strictEqual(f(local( -2, 0, 1)), "-0002"); 272 | }); 273 | 274 | it("timeFormat(\"%Z\")(date) formats time zones", () => { 275 | const f = timeFormat("%Z"); 276 | assert.strictEqual(f(local(1990, 0, 1)), "-0800"); 277 | }); 278 | 279 | it("timeFormat(\"%%\")(date) formats literal percent signs", () => { 280 | const f = timeFormat("%%"); 281 | assert.strictEqual(f(local(1990, 0, 1)), "%"); 282 | }); 283 | 284 | it("timeFormat(…) can be used to create a conditional multi-format", () => { 285 | assert.strictEqual(multi(local(1990, 0, 1, 0, 0, 0, 12)), ".012"); 286 | assert.strictEqual(multi(local(1990, 0, 1, 0, 0, 1, 0)), ":01"); 287 | assert.strictEqual(multi(local(1990, 0, 1, 0, 1, 0, 0)), "12:01"); 288 | assert.strictEqual(multi(local(1990, 0, 1, 1, 0, 0, 0)), "01 AM"); 289 | assert.strictEqual(multi(local(1990, 0, 2, 0, 0, 0, 0)), "Tue 02"); 290 | assert.strictEqual(multi(local(1990, 1, 1, 0, 0, 0, 0)), "February"); 291 | assert.strictEqual(multi(local(1990, 0, 1, 0, 0, 0, 0)), "1990"); 292 | }); 293 | -------------------------------------------------------------------------------- /test/isoFormat-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {isoFormat} from "../src/index.js"; 3 | import {utc} from "./date.js"; 4 | 5 | it("isoFormat(date) returns an ISO 8601 UTC string", () => { 6 | assert.strictEqual(isoFormat(utc(1990, 0, 1, 0, 0, 0)), "1990-01-01T00:00:00.000Z"); 7 | assert.strictEqual(isoFormat(utc(2011, 11, 31, 23, 59, 59)), "2011-12-31T23:59:59.000Z"); 8 | }); 9 | -------------------------------------------------------------------------------- /test/isoParse-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {isoParse} from "../src/index.js"; 3 | import {utc} from "./date.js"; 4 | 5 | it("isoParse as ISO 8601", () => { 6 | assert.deepStrictEqual(isoParse("1990-01-01T00:00:00.000Z"), utc(1990, 0, 1, 0, 0, 0)); 7 | assert.deepStrictEqual(isoParse("2011-12-31T23:59:59.000Z"), utc(2011, 11, 31, 23, 59, 59)); 8 | assert.strictEqual(isoParse("1990-01-01T00:00:00.000X"), null); 9 | }); 10 | -------------------------------------------------------------------------------- /test/locale-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {readdirSync, readFileSync} from "fs"; 3 | import {join} from "path"; 4 | import {timeFormatLocale} from "../src/index.js"; 5 | 6 | it("locale data is valid", () => { 7 | for (const localePath of readdirSync("locale")) { 8 | if (!/\.json$/i.test(localePath)) continue; 9 | const locale = JSON.parse(readFileSync(join("locale", localePath), "utf8")); 10 | assert.deepStrictEqual(Object.keys(locale).sort(), ["date", "dateTime", "days", "months", "periods", "shortDays", "shortMonths", "time"]); 11 | timeFormatLocale(locale); 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /test/parse-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {readFileSync} from "fs"; 3 | import {timeFormatLocale, timeParse} from "../src/index.js"; 4 | import {local} from "./date.js"; 5 | 6 | const fiFi = JSON.parse(readFileSync("./locale/fi-FI.json")); 7 | 8 | it("parse(string) coerces the specified string to a string", () => { 9 | const p = timeParse("%c"); 10 | assert.deepStrictEqual(p({toString: function() { return "1/1/1990, 12:00:00 AM"; }}), local(1990, 0, 1)); 11 | assert.deepStrictEqual(p({toString: function() { return "1/2/1990, 12:00:00 AM"; }}), local(1990, 0, 2)); 12 | assert.deepStrictEqual(p({toString: function() { return "1/3/1990, 12:00:00 AM"; }}), local(1990, 0, 3)); 13 | assert.deepStrictEqual(p({toString: function() { return "1/4/1990, 12:00:00 AM"; }}), local(1990, 0, 4)); 14 | assert.deepStrictEqual(p({toString: function() { return "1/5/1990, 12:00:00 AM"; }}), local(1990, 0, 5)); 15 | assert.deepStrictEqual(p({toString: function() { return "1/6/1990, 12:00:00 AM"; }}), local(1990, 0, 6)); 16 | assert.deepStrictEqual(p({toString: function() { return "1/7/1990, 12:00:00 AM"; }}), local(1990, 0, 7)); 17 | }); 18 | 19 | it("timeParse(specifier) coerces the specified specifier to a string", () => { 20 | const p = timeParse({toString: function() { return "%c"; }}); 21 | assert.deepStrictEqual(p("1/1/1990, 12:00:00 AM"), local(1990, 0, 1)); 22 | }); 23 | 24 | it("timeParse(\"%a %m/%d/%Y\")(date) parses abbreviated weekday and date", () => { 25 | const p = timeParse("%a %m/%d/%Y"); 26 | assert.deepStrictEqual(p("Sun 01/01/1990"), local(1990, 0, 1)); 27 | assert.deepStrictEqual(p("Wed 02/03/1991"), local(1991, 1, 3)); 28 | assert.strictEqual(p("XXX 03/10/2010"), null); 29 | }); 30 | 31 | it("timeParse(\"%A %m/%d/%Y\")(date) parses weekday and date", () => { 32 | const p = timeParse("%A %m/%d/%Y"); 33 | assert.deepStrictEqual(p("Sunday 01/01/1990"), local(1990, 0, 1)); 34 | assert.deepStrictEqual(p("Wednesday 02/03/1991"), local(1991, 1, 3)); 35 | assert.strictEqual(p("Caturday 03/10/2010"), null); 36 | }); 37 | 38 | it("timeParse(\"%U %Y\")(date) parses week number (Sunday) and year", () => { 39 | const p = timeParse("%U %Y"); 40 | assert.deepStrictEqual(p("00 1990"), local(1989, 11, 31)); 41 | assert.deepStrictEqual(p("05 1991"), local(1991, 1, 3)); 42 | assert.deepStrictEqual(p("01 1995"), local(1995, 0, 1)); 43 | }); 44 | 45 | it("timeParse(\"%a %U %Y\")(date) parses abbreviated weekday, week number (Sunday) and year", () => { 46 | const p = timeParse("%a %U %Y"); 47 | assert.deepStrictEqual(p("Mon 00 1990"), local(1990, 0, 1)); 48 | assert.deepStrictEqual(p("Sun 05 1991"), local(1991, 1, 3)); 49 | assert.deepStrictEqual(p("Sun 01 1995"), local(1995, 0, 1)); 50 | assert.strictEqual(p("XXX 03 2010"), null); 51 | }); 52 | 53 | it("timeParse(\"%A %U %Y\")(date) parses weekday, week number (Sunday) and year", () => { 54 | const p = timeParse("%A %U %Y"); 55 | assert.deepStrictEqual(p("Monday 00 1990"), local(1990, 0, 1)); 56 | assert.deepStrictEqual(p("Sunday 05 1991"), local(1991, 1, 3)); 57 | assert.deepStrictEqual(p("Sunday 01 1995"), local(1995, 0, 1)); 58 | assert.strictEqual(p("Caturday 03 2010"), null); 59 | }); 60 | 61 | it("timeParse(\"%w %U %Y\")(date) parses numeric weekday (Sunday), week number (Sunday) and year", () => { 62 | const p = timeParse("%w %U %Y"); 63 | assert.deepStrictEqual(p("1 00 1990"), local(1990, 0, 1)); 64 | assert.deepStrictEqual(p("0 05 1991"), local(1991, 1, 3)); 65 | assert.deepStrictEqual(p("0 01 1995"), local(1995, 0, 1)); 66 | assert.strictEqual(p("X 03 2010"), null); 67 | }); 68 | 69 | it("timeParse(\"%w %V %G\")(date) parses numeric weekday, week number (ISO) and corresponding year", () => { 70 | const p = timeParse("%w %V %G"); 71 | assert.deepStrictEqual(p("1 01 1990"), local(1990, 0, 1)); 72 | assert.deepStrictEqual(p("0 05 1991"), local(1991, 1, 3)); 73 | assert.deepStrictEqual(p("4 53 1992"), local(1992, 11, 31)); 74 | assert.deepStrictEqual(p("0 52 1994"), local(1995, 0, 1)); 75 | assert.deepStrictEqual(p("0 01 1995"), local(1995, 0, 8)); 76 | assert.deepStrictEqual(p("1 01 2018"), local(2018, 0, 1)); 77 | assert.deepStrictEqual(p("1 01 2019"), local(2018, 11, 31)); 78 | }); 79 | 80 | it("timeParse(\"%w %V %g\")(date) parses numeric weekday, week number (ISO) and corresponding two-digits year", () => { 81 | const p = timeParse("%w %V %g"); 82 | assert.deepStrictEqual(p("1 01 90"), local(1990, 0, 1)); 83 | assert.deepStrictEqual(p("0 05 91"), local(1991, 1, 3)); 84 | assert.deepStrictEqual(p("4 53 92"), local(1992, 11, 31)); 85 | assert.deepStrictEqual(p("0 52 94"), local(1995, 0, 1)); 86 | assert.deepStrictEqual(p("0 01 95"), local(1995, 0, 8)); 87 | assert.deepStrictEqual(p("1 01 18"), local(2018, 0, 1)); 88 | assert.deepStrictEqual(p("1 01 19"), local(2018, 11, 31)); 89 | }); 90 | 91 | it("timeParse(\"%V %g\")(date) parses week number (ISO) and corresponding two-digits year", () => { 92 | const p = timeParse("%V %g"); 93 | assert.deepStrictEqual(p("01 90"), local(1990, 0, 1)); 94 | assert.deepStrictEqual(p("05 91"), local(1991, 0, 28)); 95 | assert.deepStrictEqual(p("53 92"), local(1992, 11, 28)); 96 | assert.deepStrictEqual(p("52 94"), local(1994, 11, 26)); 97 | assert.deepStrictEqual(p("01 95"), local(1995, 0, 2)); 98 | assert.deepStrictEqual(p("01 18"), local(2018, 0, 1)); 99 | assert.deepStrictEqual(p("01 19"), local(2018, 11, 31)); 100 | }); 101 | 102 | it("timeParse(\"%u %U %Y\")(date) parses numeric weekday (Monday), week number (Monday) and year", () => { 103 | const p = timeParse("%u %W %Y"); 104 | assert.deepStrictEqual(p("1 00 1990"), local(1989, 11, 25)); 105 | assert.deepStrictEqual(p("1 01 1990"), local(1990, 0, 1)); 106 | assert.deepStrictEqual(p("1 05 1991"), local(1991, 1, 4)); 107 | assert.deepStrictEqual(p("7 00 1995"), local(1995, 0, 1)); 108 | assert.deepStrictEqual(p("1 01 1995"), local(1995, 0, 2)); 109 | assert.strictEqual(p("X 03 2010"), null); 110 | }); 111 | 112 | it("timeParse(\"%W %Y\")(date) parses week number (Monday) and year", () => { 113 | const p = timeParse("%W %Y"); 114 | assert.deepStrictEqual(p("01 1990"), local(1990, 0, 1)); 115 | assert.deepStrictEqual(p("04 1991"), local(1991, 0, 28)); 116 | assert.deepStrictEqual(p("00 1995"), local(1994, 11, 26)); 117 | }); 118 | 119 | it("timeParse(\"%a %W %Y\")(date) parses abbreviated weekday, week number (Monday) and year", () => { 120 | const p = timeParse("%a %W %Y"); 121 | assert.deepStrictEqual(p("Mon 01 1990"), local(1990, 0, 1)); 122 | assert.deepStrictEqual(p("Sun 04 1991"), local(1991, 1, 3)); 123 | assert.deepStrictEqual(p("Sun 00 1995"), local(1995, 0, 1)); 124 | assert.strictEqual(p("XXX 03 2010"), null); 125 | }); 126 | 127 | it("timeParse(\"%A %W %Y\")(date) parses weekday, week number (Monday) and year", () => { 128 | const p = timeParse("%A %W %Y"); 129 | assert.deepStrictEqual(p("Monday 01 1990"), local(1990, 0, 1)); 130 | assert.deepStrictEqual(p("Sunday 04 1991"), local(1991, 1, 3)); 131 | assert.deepStrictEqual(p("Sunday 00 1995"), local(1995, 0, 1)); 132 | assert.strictEqual(p("Caturday 03 2010"), null); 133 | }); 134 | 135 | it("timeParse(\"%w %W %Y\")(date) parses numeric weekday (Sunday), week number (Monday) and year", () => { 136 | const p = timeParse("%w %W %Y"); 137 | assert.deepStrictEqual(p("1 01 1990"), local(1990, 0, 1)); 138 | assert.deepStrictEqual(p("0 04 1991"), local(1991, 1, 3)); 139 | assert.deepStrictEqual(p("0 00 1995"), local(1995, 0, 1)); 140 | assert.strictEqual(p("X 03 2010"), null); 141 | }); 142 | 143 | it("timeParse(\"%u %W %Y\")(date) parses numeric weekday (Monday), week number (Monday) and year", () => { 144 | const p = timeParse("%u %W %Y"); 145 | assert.deepStrictEqual(p("1 01 1990"), local(1990, 0, 1)); 146 | assert.deepStrictEqual(p("7 04 1991"), local(1991, 1, 3)); 147 | assert.deepStrictEqual(p("7 00 1995"), local(1995, 0, 1)); 148 | assert.strictEqual(p("X 03 2010"), null); 149 | }); 150 | 151 | it("timeParse(\"%m/%d/%y\")(date) parses month, date and two-digit year", () => { 152 | const p = timeParse("%m/%d/%y"); 153 | assert.deepStrictEqual(p("02/03/69"), local(1969, 1, 3)); 154 | assert.deepStrictEqual(p("01/01/90"), local(1990, 0, 1)); 155 | assert.deepStrictEqual(p("02/03/91"), local(1991, 1, 3)); 156 | assert.deepStrictEqual(p("02/03/68"), local(2068, 1, 3)); 157 | assert.strictEqual(p("03/10/2010"), null); 158 | }); 159 | 160 | it("timeParse(\"%x\")(date) parses locale date", () => { 161 | const p = timeParse("%x"); 162 | assert.deepStrictEqual(p("1/1/1990"), local(1990, 0, 1)); 163 | assert.deepStrictEqual(p("2/3/1991"), local(1991, 1, 3)); 164 | assert.deepStrictEqual(p("3/10/2010"), local(2010, 2, 10)); 165 | }); 166 | 167 | it("timeParse(\"%b %d, %Y\")(date) parses abbreviated month, date and year", () => { 168 | const p = timeParse("%b %d, %Y"); 169 | assert.deepStrictEqual(p("jan 01, 1990"), local(1990, 0, 1)); 170 | assert.deepStrictEqual(p("feb 2, 2010"), local(2010, 1, 2)); 171 | assert.strictEqual(p("jan. 1, 1990"), null); 172 | }); 173 | 174 | it("timeParse(\"%B %d, %Y\")(date) parses month, date and year", () => { 175 | const p = timeParse("%B %d, %Y"); 176 | assert.deepStrictEqual(p("january 01, 1990"), local(1990, 0, 1)); 177 | assert.deepStrictEqual(p("February 2, 2010"), local(2010, 1, 2)); 178 | assert.strictEqual(p("jan 1, 1990"), null); 179 | }); 180 | 181 | it("timeParse(\"%j %m/%d/%Y\")(date) parses day of year and date", () => { 182 | const p = timeParse("%j %m/%d/%Y"); 183 | assert.deepStrictEqual(p("001 01/01/1990"), local(1990, 0, 1)); 184 | assert.deepStrictEqual(p("034 02/03/1991"), local(1991, 1, 3)); 185 | assert.strictEqual(p("2012 03/10/2010"), null); 186 | }); 187 | 188 | it("timeParse(\"%c\")(date) parses locale date and time", () => { 189 | const p = timeParse("%c"); 190 | assert.deepStrictEqual(p("1/1/1990, 12:00:00 AM"), local(1990, 0, 1)); 191 | }); 192 | 193 | it("timeParse(\"%H:%M:%S\")(date) parses twenty-four hour, minute and second", () => { 194 | const p = timeParse("%H:%M:%S"); 195 | assert.deepStrictEqual(p("00:00:00"), local(1900, 0, 1, 0, 0, 0)); 196 | assert.deepStrictEqual(p("11:59:59"), local(1900, 0, 1, 11, 59, 59)); 197 | assert.deepStrictEqual(p("12:00:00"), local(1900, 0, 1, 12, 0, 0)); 198 | assert.deepStrictEqual(p("12:00:01"), local(1900, 0, 1, 12, 0, 1)); 199 | assert.deepStrictEqual(p("23:59:59"), local(1900, 0, 1, 23, 59, 59)); 200 | }); 201 | 202 | it("timeParse(\"%X\")(date) parses locale time", () => { 203 | const p = timeParse("%X"); 204 | assert.deepStrictEqual(p("12:00:00 AM"), local(1900, 0, 1, 0, 0, 0)); 205 | assert.deepStrictEqual(p("11:59:59 AM"), local(1900, 0, 1, 11, 59, 59)); 206 | assert.deepStrictEqual(p("12:00:00 PM"), local(1900, 0, 1, 12, 0, 0)); 207 | assert.deepStrictEqual(p("12:00:01 PM"), local(1900, 0, 1, 12, 0, 1)); 208 | assert.deepStrictEqual(p("11:59:59 PM"), local(1900, 0, 1, 23, 59, 59)); 209 | }); 210 | 211 | it("timeParse(\"%L\")(date) parses milliseconds", () => { 212 | const p = timeParse("%L"); 213 | assert.deepStrictEqual(p("432"), local(1900, 0, 1, 0, 0, 0, 432)); 214 | }); 215 | 216 | it("timeParse(\"%f\")(date) parses microseconds", () => { 217 | const p = timeParse("%f"); 218 | assert.deepStrictEqual(p("432000"), local(1900, 0, 1, 0, 0, 0, 432)); 219 | }); 220 | 221 | it("timeParse(\"%I:%M:%S %p\")(date) parses twelve hour, minute and second", () => { 222 | const p = timeParse("%I:%M:%S %p"); 223 | assert.deepStrictEqual(p("12:00:00 am"), local(1900, 0, 1, 0, 0, 0)); 224 | assert.deepStrictEqual(p("11:59:59 AM"), local(1900, 0, 1, 11, 59, 59)); 225 | assert.deepStrictEqual(p("12:00:00 pm"), local(1900, 0, 1, 12, 0, 0)); 226 | assert.deepStrictEqual(p("12:00:01 pm"), local(1900, 0, 1, 12, 0, 1)); 227 | assert.deepStrictEqual(p("11:59:59 PM"), local(1900, 0, 1, 23, 59, 59)); 228 | }); 229 | 230 | it("timeParse(\"%I %p\")(date) parses period in non-English locales", () => { 231 | const p = timeFormatLocale(fiFi).parse("%I:%M:%S %p"); 232 | assert.deepStrictEqual(p("12:00:00 a.m."), local(1900, 0, 1, 0, 0, 0)); 233 | assert.deepStrictEqual(p("11:59:59 A.M."), local(1900, 0, 1, 11, 59, 59)); 234 | assert.deepStrictEqual(p("12:00:00 p.m."), local(1900, 0, 1, 12, 0, 0)); 235 | assert.deepStrictEqual(p("12:00:01 p.m."), local(1900, 0, 1, 12, 0, 1)); 236 | assert.deepStrictEqual(p("11:59:59 P.M."), local(1900, 0, 1, 23, 59, 59)); 237 | }); 238 | 239 | it("timeParse(\"%Y %q\")(date) parses quarters", () => { 240 | const p = timeParse("%Y %q"); 241 | assert.deepStrictEqual(p("1990 1"), local(1990, 0, 1)); 242 | assert.deepStrictEqual(p("1990 2"), local(1990, 3, 1)); 243 | assert.deepStrictEqual(p("1990 3"), local(1990, 6, 1)); 244 | assert.deepStrictEqual(p("1990 4"), local(1990, 9, 1)); 245 | }); 246 | 247 | it("timeParse(\"%Y %q %m\")(date) gives the month number priority", () => { 248 | const p = timeParse("%Y %q %m"); 249 | assert.deepStrictEqual(p("1990 1 2"), local(1990, 1, 1)); 250 | assert.deepStrictEqual(p("1990 2 5"), local(1990, 4, 1)); 251 | assert.deepStrictEqual(p("1990 3 8"), local(1990, 7, 1)); 252 | assert.deepStrictEqual(p("1990 4 9"), local(1990, 8, 1)); 253 | }); 254 | 255 | it("timeParse(\"%% %m/%d/%Y\")(date) parses literal %", () => { 256 | const p = timeParse("%% %m/%d/%Y"); 257 | assert.deepStrictEqual(p("% 01/01/1990"), local(1990, 0, 1)); 258 | assert.deepStrictEqual(p("% 02/03/1991"), local(1991, 1, 3)); 259 | assert.strictEqual(p("%% 03/10/2010"), null); 260 | }); 261 | 262 | it("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset", () => { 263 | const p = timeParse("%m/%d/%Y %Z"); 264 | assert.deepStrictEqual(p("01/02/1990 +0000"), local(1990, 0, 1, 16)); 265 | assert.deepStrictEqual(p("01/02/1990 +0100"), local(1990, 0, 1, 15)); 266 | assert.deepStrictEqual(p("01/02/1990 +0130"), local(1990, 0, 1, 14, 30)); 267 | assert.deepStrictEqual(p("01/02/1990 -0100"), local(1990, 0, 1, 17)); 268 | assert.deepStrictEqual(p("01/02/1990 -0130"), local(1990, 0, 1, 17, 30)); 269 | assert.deepStrictEqual(p("01/02/1990 -0800"), local(1990, 0, 2, 0)); 270 | }); 271 | 272 | it("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form '+-hh:mm'", () => { 273 | const p = timeParse("%m/%d/%Y %Z"); 274 | assert.deepStrictEqual(p("01/02/1990 +01:30"), local(1990, 0, 1, 14, 30)); 275 | assert.deepStrictEqual(p("01/02/1990 -01:30"), local(1990, 0, 1, 17, 30)); 276 | }); 277 | 278 | it("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form '+-hh'", () => { 279 | const p = timeParse("%m/%d/%Y %Z"); 280 | assert.deepStrictEqual(p("01/02/1990 +01"), local(1990, 0, 1, 15)); 281 | assert.deepStrictEqual(p("01/02/1990 -01"), local(1990, 0, 1, 17)); 282 | }); 283 | 284 | it("timeParse(\"%m/%d/%Y %Z\")(date) parses timezone offset in the form 'Z'", () => { 285 | const p = timeParse("%m/%d/%Y %Z"); 286 | assert.deepStrictEqual(p("01/02/1990 Z"), local(1990, 0, 1, 16)); 287 | }); 288 | 289 | it("timeParse(\"%-m/%0d/%_Y\")(date) ignores optional padding modifier, skipping zeroes and spaces", () => { 290 | const p = timeParse("%-m/%0d/%_Y"); 291 | assert.deepStrictEqual(p("01/ 1/1990"), local(1990, 0, 1)); 292 | }); 293 | 294 | it("timeParse(\"%b %d, %Y\")(date) doesn't crash when given weird strings", () => { 295 | try { 296 | Object.prototype.foo = 10; 297 | const p = timeParse("%b %d, %Y"); 298 | assert.strictEqual(p("foo 1, 1990"), null); 299 | } finally { 300 | delete Object.prototype.foo; 301 | } 302 | }); 303 | -------------------------------------------------------------------------------- /test/utcFormat-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {utcSecond, utcMinute, utcHour, utcDay, utcMonth, utcWeek, utcYear} from "d3-time"; 3 | import {utcFormat} from "../src/index.js"; 4 | import {utc} from "./date.js"; 5 | 6 | const formatMillisecond = utcFormat(".%L"), 7 | formatSecond = utcFormat(":%S"), 8 | formatMinute = utcFormat("%I:%M"), 9 | formatHour = utcFormat("%I %p"), 10 | formatDay = utcFormat("%a %d"), 11 | formatWeek = utcFormat("%b %d"), 12 | formatMonth = utcFormat("%B"), 13 | formatYear = utcFormat("%Y"); 14 | 15 | function multi(d) { 16 | return (utcSecond(d) < d ? formatMillisecond 17 | : utcMinute(d) < d ? formatSecond 18 | : utcHour(d) < d ? formatMinute 19 | : utcDay(d) < d ? formatHour 20 | : utcMonth(d) < d ? (utcWeek(d) < d ? formatDay : formatWeek) 21 | : utcYear(d) < d ? formatMonth 22 | : formatYear)(d); 23 | } 24 | 25 | it("utcFormat(\"%a\")(date) formats abbreviated weekdays", () => { 26 | const f = utcFormat("%a"); 27 | assert.strictEqual(f(utc(1990, 0, 1)), "Mon"); 28 | assert.strictEqual(f(utc(1990, 0, 2)), "Tue"); 29 | assert.strictEqual(f(utc(1990, 0, 3)), "Wed"); 30 | assert.strictEqual(f(utc(1990, 0, 4)), "Thu"); 31 | assert.strictEqual(f(utc(1990, 0, 5)), "Fri"); 32 | assert.strictEqual(f(utc(1990, 0, 6)), "Sat"); 33 | assert.strictEqual(f(utc(1990, 0, 7)), "Sun"); 34 | }); 35 | 36 | it("utcFormat(\"%A\")(date) formats weekdays", () => { 37 | const f = utcFormat("%A"); 38 | assert.strictEqual(f(utc(1990, 0, 1)), "Monday"); 39 | assert.strictEqual(f(utc(1990, 0, 2)), "Tuesday"); 40 | assert.strictEqual(f(utc(1990, 0, 3)), "Wednesday"); 41 | assert.strictEqual(f(utc(1990, 0, 4)), "Thursday"); 42 | assert.strictEqual(f(utc(1990, 0, 5)), "Friday"); 43 | assert.strictEqual(f(utc(1990, 0, 6)), "Saturday"); 44 | assert.strictEqual(f(utc(1990, 0, 7)), "Sunday"); 45 | }); 46 | 47 | it("utcFormat(\"%b\")(date) formats abbreviated months", () => { 48 | const f = utcFormat("%b"); 49 | assert.strictEqual(f(utc(1990, 0, 1)), "Jan"); 50 | assert.strictEqual(f(utc(1990, 1, 1)), "Feb"); 51 | assert.strictEqual(f(utc(1990, 2, 1)), "Mar"); 52 | assert.strictEqual(f(utc(1990, 3, 1)), "Apr"); 53 | assert.strictEqual(f(utc(1990, 4, 1)), "May"); 54 | assert.strictEqual(f(utc(1990, 5, 1)), "Jun"); 55 | assert.strictEqual(f(utc(1990, 6, 1)), "Jul"); 56 | assert.strictEqual(f(utc(1990, 7, 1)), "Aug"); 57 | assert.strictEqual(f(utc(1990, 8, 1)), "Sep"); 58 | assert.strictEqual(f(utc(1990, 9, 1)), "Oct"); 59 | assert.strictEqual(f(utc(1990, 10, 1)), "Nov"); 60 | assert.strictEqual(f(utc(1990, 11, 1)), "Dec"); 61 | }); 62 | 63 | it("utcFormat(\"%B\")(date) formats months", () => { 64 | const f = utcFormat("%B"); 65 | assert.strictEqual(f(utc(1990, 0, 1)), "January"); 66 | assert.strictEqual(f(utc(1990, 1, 1)), "February"); 67 | assert.strictEqual(f(utc(1990, 2, 1)), "March"); 68 | assert.strictEqual(f(utc(1990, 3, 1)), "April"); 69 | assert.strictEqual(f(utc(1990, 4, 1)), "May"); 70 | assert.strictEqual(f(utc(1990, 5, 1)), "June"); 71 | assert.strictEqual(f(utc(1990, 6, 1)), "July"); 72 | assert.strictEqual(f(utc(1990, 7, 1)), "August"); 73 | assert.strictEqual(f(utc(1990, 8, 1)), "September"); 74 | assert.strictEqual(f(utc(1990, 9, 1)), "October"); 75 | assert.strictEqual(f(utc(1990, 10, 1)), "November"); 76 | assert.strictEqual(f(utc(1990, 11, 1)), "December"); 77 | }); 78 | 79 | it("utcFormat(\"%c\")(date) formats localized dates and times", () => { 80 | const f = utcFormat("%c"); 81 | assert.strictEqual(f(utc(1990, 0, 1)), "1/1/1990, 12:00:00 AM"); 82 | }); 83 | 84 | it("utcFormat(\"%d\")(date) formats zero-padded dates", () => { 85 | const f = utcFormat("%d"); 86 | assert.strictEqual(f(utc(1990, 0, 1)), "01"); 87 | }); 88 | 89 | it("utcFormat(\"%e\")(date) formats space-padded dates", () => { 90 | const f = utcFormat("%e"); 91 | assert.strictEqual(f(utc(1990, 0, 1)), " 1"); 92 | }); 93 | 94 | it("timeFormat(\"%g\")(date) formats zero-padded two-digit ISO 8601 years", () => { 95 | const f = utcFormat("%g"); 96 | assert.strictEqual(f(utc(2018, 11, 30, 0)), "18"); // Sunday 97 | assert.strictEqual(f(utc(2018, 11, 31, 0)), "19"); // Monday 98 | assert.strictEqual(f(utc(2019, 0, 1, 0)), "19"); 99 | }); 100 | 101 | it("utcFormat(\"%G\")(date) formats zero-padded four-digit ISO 8601 years", () => { 102 | const f = utcFormat("%G"); 103 | assert.strictEqual(f(utc(2018, 11, 30, 0)), "2018"); // Sunday 104 | assert.strictEqual(f(utc(2018, 11, 31, 0)), "2019"); // Monday 105 | assert.strictEqual(f(utc(2019, 0, 1, 0)), "2019"); 106 | }); 107 | 108 | it("utcFormat(\"%H\")(date) formats zero-padded hours (24)", () => { 109 | const f = utcFormat("%H"); 110 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "00"); 111 | assert.strictEqual(f(utc(1990, 0, 1, 13)), "13"); 112 | }); 113 | 114 | it("utcFormat(\"%I\")(date) formats zero-padded hours (12)", () => { 115 | const f = utcFormat("%I"); 116 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "12"); 117 | assert.strictEqual(f(utc(1990, 0, 1, 13)), "01"); 118 | }); 119 | 120 | it("utcFormat(\"%j\")(date) formats zero-padded day of year numbers", () => { 121 | const f = utcFormat("%j"); 122 | assert.strictEqual(f(utc(1990, 0, 1)), "001"); 123 | assert.strictEqual(f(utc(1990, 5, 1)), "152"); 124 | assert.strictEqual(f(utc(2010, 2, 13)), "072"); 125 | assert.strictEqual(f(utc(2010, 2, 14)), "073"); // DST begins 126 | assert.strictEqual(f(utc(2010, 2, 15)), "074"); 127 | assert.strictEqual(f(utc(2010, 10, 6)), "310"); 128 | assert.strictEqual(f(utc(2010, 10, 7)), "311"); // DST ends 129 | assert.strictEqual(f(utc(2010, 10, 8)), "312"); 130 | }); 131 | 132 | it("utcFormat(\"%m\")(date) formats zero-padded months", () => { 133 | const f = utcFormat("%m"); 134 | assert.strictEqual(f(utc(1990, 0, 1)), "01"); 135 | assert.strictEqual(f(utc(1990, 9, 1)), "10"); 136 | }); 137 | 138 | it("utcFormat(\"%M\")(date) formats zero-padded minutes", () => { 139 | const f = utcFormat("%M"); 140 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0)), "00"); 141 | assert.strictEqual(f(utc(1990, 0, 1, 0, 32)), "32"); 142 | }); 143 | 144 | it("utcFormat(\"%p\")(date) formats AM or PM", () => { 145 | const f = utcFormat("%p"); 146 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "AM"); 147 | assert.strictEqual(f(utc(1990, 0, 1, 13)), "PM"); 148 | }); 149 | 150 | it("utcFormat(\"%q\")(date) formats quarters", () => { 151 | const f = utcFormat("%q"); 152 | assert.strictEqual(f(utc(1990, 0, 1)), "1"); 153 | assert.strictEqual(f(utc(1990, 3, 1)), "2"); 154 | assert.strictEqual(f(utc(1990, 6, 1)), "3"); 155 | assert.strictEqual(f(utc(1990, 9, 1)), "4"); 156 | }); 157 | 158 | it("utcFormat(\"%Q\")(date) formats UNIX timestamps", () => { 159 | const f = utcFormat("%Q"); 160 | assert.strictEqual(f(utc(1970, 0, 1, 0, 0, 0)), "0"); 161 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), "631152000000"); 162 | assert.strictEqual(f(utc(1990, 0, 1, 12, 34, 56)), "631197296000"); 163 | }); 164 | 165 | it("utcFormat(\"%s\")(date) formats UNIX timetamps in seconds", () => { 166 | const f = utcFormat("%s"); 167 | assert.strictEqual(f(utc(1970, 0, 1, 0, 0, 0)), "0"); 168 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), "631152000"); 169 | assert.strictEqual(f(utc(1990, 0, 1, 12, 34, 56)), "631197296"); 170 | }); 171 | 172 | it("utcFormat(\"%s.%L\")(date) formats UNIX timetamps in seconds and milliseconds", () => { 173 | const f = utcFormat("%s.%L"); 174 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 123)), "631152000.123"); 175 | assert.strictEqual(f(utc(1990, 0, 1, 12, 34, 56, 789)), "631197296.789"); 176 | }); 177 | 178 | it("utcFormat(\"%s.%f\")(date) formats UNIX timetamps in seconds and microseconds", () => { 179 | const f = utcFormat("%s.%f"); 180 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 123)), "631152000.123000"); 181 | assert.strictEqual(f(utc(1990, 0, 1, 12, 34, 56, 789)), "631197296.789000"); 182 | }); 183 | 184 | it("utcFormat(\"%S\")(date) formats zero-padded seconds", () => { 185 | const f = utcFormat("%S"); 186 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), "00"); 187 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 32)), "32"); 188 | const f2 = utcFormat("%0S"); 189 | assert.strictEqual(f2(utc(1990, 0, 1, 0, 0, 0)), "00"); 190 | assert.strictEqual(f2(utc(1990, 0, 1, 0, 0, 32)), "32"); 191 | }); 192 | 193 | it("utcFormat(\"%_S\")(date) formats space-padded seconds", () => { 194 | const f = utcFormat("%_S"); 195 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), " 0"); 196 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 3)), " 3"); 197 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 32)), "32"); 198 | }); 199 | 200 | it("utcFormat(\"-S\")(date) formats no-padded seconds", () => { 201 | const f = utcFormat("%-S"); 202 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), "0"); 203 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 3)), "3"); 204 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 32)), "32"); 205 | }); 206 | 207 | it("utcFormat(\"%L\")(date) formats zero-padded milliseconds", () => { 208 | const f = utcFormat("%L"); 209 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 0)), "000"); 210 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 432)), "432"); 211 | }); 212 | 213 | it("utcFormat(\"%u\")(date) formats week day numbers", () => { 214 | const f = utcFormat("%u"); 215 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "1"); 216 | assert.strictEqual(f(utc(1990, 0, 7, 0)), "7"); 217 | assert.strictEqual(f(utc(2010, 2, 13, 23)), "6"); 218 | }); 219 | 220 | it("utcFormat(\"%f\")(date) formats zero-padded microseconds", () => { 221 | const f = utcFormat("%f"); 222 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 0)), "000000"); 223 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0, 432)), "432000"); 224 | }); 225 | 226 | it("utcFormat(\"%U\")(date) formats zero-padded week numbers", () => { 227 | const f = utcFormat("%U"); 228 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "00"); 229 | assert.strictEqual(f(utc(1990, 5, 1, 0)), "21"); 230 | assert.strictEqual(f(utc(2010, 2, 13, 23)), "10"); 231 | assert.strictEqual(f(utc(2010, 2, 14, 0)), "11"); // DST begins 232 | assert.strictEqual(f(utc(2010, 2, 15, 0)), "11"); 233 | assert.strictEqual(f(utc(2010, 10, 6, 23)), "44"); 234 | assert.strictEqual(f(utc(2010, 10, 7, 0)), "45"); // DST ends 235 | assert.strictEqual(f(utc(2010, 10, 8, 0)), "45"); 236 | assert.strictEqual(f(utc(2012, 0, 1, 0)), "01"); // Sunday! 237 | }); 238 | 239 | it("utcFormat(\"%W\")(date) formats zero-padded week numbers", () => { 240 | const f = utcFormat("%W"); 241 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "01"); // Monday! 242 | assert.strictEqual(f(utc(1990, 5, 1, 0)), "22"); 243 | assert.strictEqual(f(utc(2010, 2, 15, 0)), "11"); 244 | assert.strictEqual(f(utc(2010, 10, 8, 0)), "45"); 245 | }); 246 | 247 | it("utcFormat(\"%V\")(date) formats zero-padded ISO 8601 week numbers", () => { 248 | const f = utcFormat("%V"); 249 | assert.strictEqual(f(utc(1990, 0, 1, 0)), "01"); 250 | assert.strictEqual(f(utc(1990, 5, 1, 0)), "22"); 251 | assert.strictEqual(f(utc(2010, 2, 13, 23)), "10"); 252 | assert.strictEqual(f(utc(2010, 2, 14, 0)), "10"); // DST begins 253 | assert.strictEqual(f(utc(2010, 2, 15, 0)), "11"); 254 | assert.strictEqual(f(utc(2010, 10, 6, 23)), "44"); 255 | assert.strictEqual(f(utc(2010, 10, 7, 0)), "44"); // DST ends 256 | assert.strictEqual(f(utc(2010, 10, 8, 0)), "45"); 257 | assert.strictEqual(f(utc(2015, 11, 31, 0)), "53"); 258 | assert.strictEqual(f(utc(2016, 0, 1, 0)), "53"); 259 | }); 260 | 261 | it("utcFormat(\"%x\")(date) formats localized dates", () => { 262 | const f = utcFormat("%x"); 263 | assert.strictEqual(f(utc(1990, 0, 1)), "1/1/1990"); 264 | assert.strictEqual(f(utc(2010, 5, 1)), "6/1/2010"); 265 | }); 266 | 267 | it("utcFormat(\"%X\")(date) formats localized times", () => { 268 | const f = utcFormat("%X"); 269 | assert.strictEqual(f(utc(1990, 0, 1, 0, 0, 0)), "12:00:00 AM"); 270 | assert.strictEqual(f(utc(1990, 0, 1, 13, 34, 59)), "1:34:59 PM"); 271 | }); 272 | 273 | it("utcFormat(\"%y\")(date) formats zero-padded two-digit years", () => { 274 | const f = utcFormat("%y"); 275 | assert.strictEqual(f(utc(+1990, 0, 1)), "90"); 276 | assert.strictEqual(f(utc(+2002, 0, 1)), "02"); 277 | assert.strictEqual(f(utc(-2, 0, 1)), "-02"); 278 | }); 279 | 280 | it("utcFormat(\"%Y\")(date) formats zero-padded four-digit years", () => { 281 | const f = utcFormat("%Y"); 282 | assert.strictEqual(f(utc( 123, 0, 1)), "0123"); 283 | assert.strictEqual(f(utc( 1990, 0, 1)), "1990"); 284 | assert.strictEqual(f(utc( 2002, 0, 1)), "2002"); 285 | assert.strictEqual(f(utc(10002, 0, 1)), "0002"); 286 | assert.strictEqual(f(utc( -2, 0, 1)), "-0002"); 287 | }); 288 | 289 | it("utcFormat(\"%Z\")(date) formats time zones", () => { 290 | const f = utcFormat("%Z"); 291 | assert.strictEqual(f(utc(1990, 0, 1)), "+0000"); 292 | }); 293 | 294 | it("utcFormat(\"%%\")(date) formats literal percent signs", () => { 295 | const f = utcFormat("%%"); 296 | assert.strictEqual(f(utc(1990, 0, 1)), "%"); 297 | }); 298 | 299 | it("utcFormat(…) can be used to create a conditional multi-format", () => { 300 | assert.strictEqual(multi(utc(1990, 0, 1, 0, 0, 0, 12)), ".012"); 301 | assert.strictEqual(multi(utc(1990, 0, 1, 0, 0, 1, 0)), ":01"); 302 | assert.strictEqual(multi(utc(1990, 0, 1, 0, 1, 0, 0)), "12:01"); 303 | assert.strictEqual(multi(utc(1990, 0, 1, 1, 0, 0, 0)), "01 AM"); 304 | assert.strictEqual(multi(utc(1990, 0, 2, 0, 0, 0, 0)), "Tue 02"); 305 | assert.strictEqual(multi(utc(1990, 1, 1, 0, 0, 0, 0)), "February"); 306 | assert.strictEqual(multi(utc(1990, 0, 1, 0, 0, 0, 0)), "1990"); 307 | }); 308 | -------------------------------------------------------------------------------- /test/utcParse-test.js: -------------------------------------------------------------------------------- 1 | import assert from "assert"; 2 | import {utcParse} from "../src/index.js"; 3 | import {local, utc} from "./date.js"; 4 | 5 | it("utcParse(specifier) coerces the specified specifier to a string", () => { 6 | const p = utcParse({toString: function() { return "%c"; }}); 7 | assert.deepStrictEqual(p("1/1/1990, 12:00:00 AM"), utc(1990, 0, 1)); 8 | }); 9 | 10 | it("utcParse(\"\")(date) parses abbreviated weekday and numeric date", () => { 11 | const p = utcParse("%a %m/%d/%Y"); 12 | assert.deepStrictEqual(p("Sun 01/01/1990"), utc(1990, 0, 1)); 13 | assert.deepStrictEqual(p("Wed 02/03/1991"), utc(1991, 1, 3)); 14 | assert.strictEqual(p("XXX 03/10/2010"), null); 15 | }); 16 | 17 | it("utcParse(\"\")(date) parses weekday and numeric date", () => { 18 | const p = utcParse("%A %m/%d/%Y"); 19 | assert.deepStrictEqual(p("Sunday 01/01/1990"), utc(1990, 0, 1)); 20 | assert.deepStrictEqual(p("Wednesday 02/03/1991"), utc(1991, 1, 3)); 21 | assert.strictEqual(p("Caturday 03/10/2010"), null); 22 | }); 23 | 24 | it("utcParse(\"\")(date) parses numeric date", () => { 25 | const p = utcParse("%m/%d/%y"); 26 | assert.deepStrictEqual(p("01/01/90"), utc(1990, 0, 1)); 27 | assert.deepStrictEqual(p("02/03/91"), utc(1991, 1, 3)); 28 | assert.strictEqual(p("03/10/2010"), null); 29 | }); 30 | 31 | it("utcParse(\"\")(date) parses locale date", () => { 32 | const p = utcParse("%x"); 33 | assert.deepStrictEqual(p("01/01/1990"), utc(1990, 0, 1)); 34 | assert.deepStrictEqual(p("02/03/1991"), utc(1991, 1, 3)); 35 | assert.deepStrictEqual(p("03/10/2010"), utc(2010, 2, 10)); 36 | }); 37 | 38 | it("utcParse(\"\")(date) parses abbreviated month, date and year", () => { 39 | const p = utcParse("%b %d, %Y"); 40 | assert.deepStrictEqual(p("jan 01, 1990"), utc(1990, 0, 1)); 41 | assert.deepStrictEqual(p("feb 2, 2010"), utc(2010, 1, 2)); 42 | assert.strictEqual(p("jan. 1, 1990"), null); 43 | }); 44 | 45 | it("utcParse(\"\")(date) parses month, date and year", () => { 46 | const p = utcParse("%B %d, %Y"); 47 | assert.deepStrictEqual(p("january 01, 1990"), utc(1990, 0, 1)); 48 | assert.deepStrictEqual(p("February 2, 2010"), utc(2010, 1, 2)); 49 | assert.strictEqual(p("jan 1, 1990"), null); 50 | }); 51 | 52 | it("utcParse(\"\")(date) parses locale date and time", () => { 53 | const p = utcParse("%c"); 54 | assert.deepStrictEqual(p("1/1/1990, 12:00:00 AM"), utc(1990, 0, 1)); 55 | }); 56 | 57 | it("utcParse(\"\")(date) parses twenty-four hour, minute and second", () => { 58 | const p = utcParse("%H:%M:%S"); 59 | assert.deepStrictEqual(p("00:00:00"), utc(1900, 0, 1, 0, 0, 0)); 60 | assert.deepStrictEqual(p("11:59:59"), utc(1900, 0, 1, 11, 59, 59)); 61 | assert.deepStrictEqual(p("12:00:00"), utc(1900, 0, 1, 12, 0, 0)); 62 | assert.deepStrictEqual(p("12:00:01"), utc(1900, 0, 1, 12, 0, 1)); 63 | assert.deepStrictEqual(p("23:59:59"), utc(1900, 0, 1, 23, 59, 59)); 64 | }); 65 | 66 | it("utcParse(\"\")(date) parses locale time", () => { 67 | const p = utcParse("%X"); 68 | assert.deepStrictEqual(p("12:00:00 AM"), utc(1900, 0, 1, 0, 0, 0)); 69 | assert.deepStrictEqual(p("11:59:59 AM"), utc(1900, 0, 1, 11, 59, 59)); 70 | assert.deepStrictEqual(p("12:00:00 PM"), utc(1900, 0, 1, 12, 0, 0)); 71 | assert.deepStrictEqual(p("12:00:01 PM"), utc(1900, 0, 1, 12, 0, 1)); 72 | assert.deepStrictEqual(p("11:59:59 PM"), utc(1900, 0, 1, 23, 59, 59)); 73 | }); 74 | 75 | it("utcParse(\"%L\")(date) parses milliseconds", () => { 76 | const p = utcParse("%L"); 77 | assert.deepStrictEqual(p("432"), utc(1900, 0, 1, 0, 0, 0, 432)); 78 | }); 79 | 80 | it("utcParse(\"%f\")(date) parses microseconds", () => { 81 | const p = utcParse("%f"); 82 | assert.deepStrictEqual(p("432000"), utc(1900, 0, 1, 0, 0, 0, 432)); 83 | }); 84 | 85 | it("utcParse(\"\")(date) parses twelve hour, minute and second", () => { 86 | const p = utcParse("%I:%M:%S %p"); 87 | assert.deepStrictEqual(p("12:00:00 am"), utc(1900, 0, 1, 0, 0, 0)); 88 | assert.deepStrictEqual(p("11:59:59 AM"), utc(1900, 0, 1, 11, 59, 59)); 89 | assert.deepStrictEqual(p("12:00:00 pm"), utc(1900, 0, 1, 12, 0, 0)); 90 | assert.deepStrictEqual(p("12:00:01 pm"), utc(1900, 0, 1, 12, 0, 1)); 91 | assert.deepStrictEqual(p("11:59:59 PM"), utc(1900, 0, 1, 23, 59, 59)); 92 | }); 93 | 94 | it("utcParse(\"\")(date) parses timezone offset", () => { 95 | const p = utcParse("%m/%d/%Y %Z"); 96 | assert.deepStrictEqual(p("01/02/1990 +0000"), utc(1990, 0, 2)); 97 | assert.deepStrictEqual(p("01/02/1990 +0100"), utc(1990, 0, 1, 23)); 98 | assert.deepStrictEqual(p("01/02/1990 -0100"), utc(1990, 0, 2, 1)); 99 | assert.deepStrictEqual(p("01/02/1990 -0800"), local(1990, 0, 2)); 100 | }); 101 | 102 | it("utcParse(\"\")(date) parses timezone offset (in the form '+-hh:mm')", () => { 103 | const p = utcParse("%m/%d/%Y %Z"); 104 | assert.deepStrictEqual(p("01/02/1990 +01:30"), utc(1990, 0, 1, 22, 30)); 105 | assert.deepStrictEqual(p("01/02/1990 -01:30"), utc(1990, 0, 2, 1, 30)); 106 | }); 107 | 108 | it("utcParse(\"\")(date) parses timezone offset (in the form '+-hh')", () => { 109 | const p = utcParse("%m/%d/%Y %Z"); 110 | assert.deepStrictEqual(p("01/02/1990 +01"), utc(1990, 0, 1, 23)); 111 | assert.deepStrictEqual(p("01/02/1990 -01"), utc(1990, 0, 2, 1)); 112 | }); 113 | 114 | it("utcParse(\"\")(date) parses timezone offset (in the form 'Z')", () => { 115 | const p = utcParse("%m/%d/%Y %Z"); 116 | assert.deepStrictEqual(p("01/02/1990 Z"), utc(1990, 0, 2)); 117 | }); 118 | 119 | it("utcParse(\"%Y %U %w\")(date) handles a year that starts on Sunday", () => { 120 | const p = utcParse("%Y %U %w"); 121 | assert.deepStrictEqual(p("2012 01 0"), utc(2012, 0, 1)); 122 | }); 123 | 124 | it("utcParse(\"%w %V %Y\")(date) parses numeric weekday, week number (ISO) and year", () => { 125 | const p = utcParse("%w %V %Y"); 126 | assert.deepStrictEqual(p("1 01 1990"), utc(1990, 0, 1)); 127 | assert.deepStrictEqual(p("0 05 1991"), utc(1991, 1, 3)); 128 | assert.deepStrictEqual(p("4 53 1992"), utc(1992, 11, 31)); 129 | assert.deepStrictEqual(p("0 52 1994"), utc(1995, 0, 1)); 130 | assert.deepStrictEqual(p("0 01 1995"), utc(1995, 0, 8)); 131 | assert.strictEqual(p("X 03 2010"), null); 132 | }); 133 | 134 | it("utcParse(\"%w %V %G\")(date) parses numeric weekday, week number (ISO) and corresponding year", () => { 135 | const p = utcParse("%w %V %G"); 136 | assert.deepStrictEqual(p("1 01 1990"), utc(1990, 0, 1)); 137 | assert.deepStrictEqual(p("0 05 1991"), utc(1991, 1, 3)); 138 | assert.deepStrictEqual(p("4 53 1992"), utc(1992, 11, 31)); 139 | assert.deepStrictEqual(p("0 52 1994"), utc(1995, 0, 1)); 140 | assert.deepStrictEqual(p("0 01 1995"), utc(1995, 0, 8)); 141 | assert.deepStrictEqual(p("1 01 2018"), utc(2018, 0, 1)); 142 | assert.deepStrictEqual(p("1 01 2019"), utc(2018, 11, 31)); 143 | assert.strictEqual(p("X 03 2010"), null); 144 | }); 145 | 146 | it("utcParse(\"%V %Y\")(date) week number (ISO) and year", () => { 147 | const p = utcParse("%V %Y"); 148 | assert.deepStrictEqual(p("01 1990"), utc(1990, 0, 1)); 149 | assert.deepStrictEqual(p("05 1991"), utc(1991, 0, 28)); 150 | assert.deepStrictEqual(p("53 1992"), utc(1992, 11, 28)); 151 | assert.deepStrictEqual(p("01 1993"), utc(1993, 0, 4)); 152 | assert.deepStrictEqual(p("01 1995"), utc(1995, 0, 2)); 153 | assert.deepStrictEqual(p("00 1995"), null); 154 | assert.deepStrictEqual(p("54 1995"), null); 155 | assert.deepStrictEqual(p("X 1995"), null); 156 | }); 157 | 158 | it("utcParse(\"%V %g\")(date) week number (ISO) and corresponding two-digits year", () => { 159 | const p = utcParse("%V %g"); 160 | assert.deepStrictEqual(p("01 90"), utc(1990, 0, 1)); 161 | assert.deepStrictEqual(p("05 91"), utc(1991, 0, 28)); 162 | assert.deepStrictEqual(p("53 92"), utc(1992, 11, 28)); 163 | assert.deepStrictEqual(p("01 93"), utc(1993, 0, 4)); 164 | assert.deepStrictEqual(p("01 95"), utc(1995, 0, 2)); 165 | assert.deepStrictEqual(p("01 18"), utc(2018, 0, 1)); 166 | assert.deepStrictEqual(p("01 19"), utc(2018, 11, 31)); 167 | assert.deepStrictEqual(p("00 95"), null); 168 | assert.deepStrictEqual(p("54 95"), null); 169 | assert.deepStrictEqual(p("X 95"), null); 170 | }); 171 | 172 | it("utcParse(\"%V %G\")(date) week number (ISO) and corresponding year", () => { 173 | const p = utcParse("%V %G"); 174 | assert.deepStrictEqual(p("01 1990"), utc(1990, 0, 1)); 175 | assert.deepStrictEqual(p("05 1991"), utc(1991, 0, 28)); 176 | assert.deepStrictEqual(p("53 1992"), utc(1992, 11, 28)); 177 | assert.deepStrictEqual(p("01 1993"), utc(1993, 0, 4)); 178 | assert.deepStrictEqual(p("01 1995"), utc(1995, 0, 2)); 179 | assert.deepStrictEqual(p("01 2018"), utc(2018, 0, 1)); 180 | assert.deepStrictEqual(p("01 2019"), utc(2018, 11, 31)); 181 | assert.deepStrictEqual(p("00 1995"), null); 182 | assert.deepStrictEqual(p("54 1995"), null); 183 | assert.deepStrictEqual(p("X 1995"), null); 184 | }); 185 | 186 | it("utcParse(\"%Q\")(date) parses UNIX timestamps", () => { 187 | const p = utcParse("%Q"); 188 | assert.deepStrictEqual(p("0"), utc(1970, 0, 1)); 189 | assert.deepStrictEqual(p("631152000000"), utc(1990, 0, 1)); 190 | }); 191 | 192 | it("utcParse(\"%s\")(date) parses UNIX timestamps in seconds", () => { 193 | const p = utcParse("%s"); 194 | assert.deepStrictEqual(p("0"), utc(1970, 0, 1)); 195 | assert.deepStrictEqual(p("631152000"), utc(1990, 0, 1)); 196 | }); 197 | 198 | it("utcParse(\"%s.%L\")(date) parses UNIX timetamps in seconds and milliseconds", () => { 199 | const p = utcParse("%s.%L"); 200 | assert.deepStrictEqual(p("631152000.123"), utc(1990, 0, 1, 0, 0, 0, 123)); 201 | assert.deepStrictEqual(p("631197296.789"), utc(1990, 0, 1, 12, 34, 56, 789)); 202 | }); 203 | 204 | it("utcParse(\"%s.%f\")(date) parses UNIX timetamps in seconds and microseconds", () => { 205 | const p = utcParse("%s.%f"); 206 | assert.deepStrictEqual(p("631152000.123000"), utc(1990, 0, 1, 0, 0, 0, 123)); 207 | assert.deepStrictEqual(p("631197296.789000"), utc(1990, 0, 1, 12, 34, 56, 789)); 208 | }); 209 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@babel/code-frame@^7.10.4": 6 | version "7.16.0" 7 | resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.0.tgz#0dfc80309beec8411e65e706461c408b0bb9b431" 8 | integrity sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA== 9 | dependencies: 10 | "@babel/highlight" "^7.16.0" 11 | 12 | "@babel/helper-validator-identifier@^7.15.7": 13 | version "7.15.7" 14 | resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" 15 | integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== 16 | 17 | "@babel/highlight@^7.16.0": 18 | version "7.16.0" 19 | resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.0.tgz#6ceb32b2ca4b8f5f361fb7fd821e3fddf4a1725a" 20 | integrity sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g== 21 | dependencies: 22 | "@babel/helper-validator-identifier" "^7.15.7" 23 | chalk "^2.0.0" 24 | js-tokens "^4.0.0" 25 | 26 | "@eslint/eslintrc@^1.0.5": 27 | version "1.0.5" 28 | resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.0.5.tgz#33f1b838dbf1f923bfa517e008362b78ddbbf318" 29 | integrity sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ== 30 | dependencies: 31 | ajv "^6.12.4" 32 | debug "^4.3.2" 33 | espree "^9.2.0" 34 | globals "^13.9.0" 35 | ignore "^4.0.6" 36 | import-fresh "^3.2.1" 37 | js-yaml "^4.1.0" 38 | minimatch "^3.0.4" 39 | strip-json-comments "^3.1.1" 40 | 41 | "@humanwhocodes/config-array@^0.9.2": 42 | version "0.9.2" 43 | resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.2.tgz#68be55c737023009dfc5fe245d51181bb6476914" 44 | integrity sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA== 45 | dependencies: 46 | "@humanwhocodes/object-schema" "^1.2.1" 47 | debug "^4.1.1" 48 | minimatch "^3.0.4" 49 | 50 | "@humanwhocodes/object-schema@^1.2.1": 51 | version "1.2.1" 52 | resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" 53 | integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== 54 | 55 | "@types/node@*": 56 | version "16.11.11" 57 | resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.11.tgz#6ea7342dfb379ea1210835bada87b3c512120234" 58 | integrity sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw== 59 | 60 | "@ungap/promise-all-settled@1.1.2": 61 | version "1.1.2" 62 | resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" 63 | integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== 64 | 65 | acorn-jsx@^5.3.1: 66 | version "5.3.2" 67 | resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" 68 | integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== 69 | 70 | acorn@^8.6.0: 71 | version "8.6.0" 72 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.6.0.tgz#e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895" 73 | integrity sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw== 74 | 75 | ajv@^6.10.0, ajv@^6.12.4: 76 | version "6.12.6" 77 | resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" 78 | integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== 79 | dependencies: 80 | fast-deep-equal "^3.1.1" 81 | fast-json-stable-stringify "^2.0.0" 82 | json-schema-traverse "^0.4.1" 83 | uri-js "^4.2.2" 84 | 85 | ansi-colors@4.1.1, ansi-colors@^4.1.1: 86 | version "4.1.1" 87 | resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" 88 | integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== 89 | 90 | ansi-regex@^5.0.1: 91 | version "5.0.1" 92 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" 93 | integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== 94 | 95 | ansi-styles@^3.2.1: 96 | version "3.2.1" 97 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" 98 | integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== 99 | dependencies: 100 | color-convert "^1.9.0" 101 | 102 | ansi-styles@^4.0.0, ansi-styles@^4.1.0: 103 | version "4.3.0" 104 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" 105 | integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== 106 | dependencies: 107 | color-convert "^2.0.1" 108 | 109 | anymatch@~3.1.2: 110 | version "3.1.2" 111 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" 112 | integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== 113 | dependencies: 114 | normalize-path "^3.0.0" 115 | picomatch "^2.0.4" 116 | 117 | argparse@^2.0.1: 118 | version "2.0.1" 119 | resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" 120 | integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== 121 | 122 | balanced-match@^1.0.0: 123 | version "1.0.2" 124 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" 125 | integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== 126 | 127 | binary-extensions@^2.0.0: 128 | version "2.2.0" 129 | resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" 130 | integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== 131 | 132 | brace-expansion@^1.1.7: 133 | version "1.1.11" 134 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" 135 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== 136 | dependencies: 137 | balanced-match "^1.0.0" 138 | concat-map "0.0.1" 139 | 140 | braces@~3.0.2: 141 | version "3.0.2" 142 | resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" 143 | integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== 144 | dependencies: 145 | fill-range "^7.0.1" 146 | 147 | browser-stdout@1.3.1: 148 | version "1.3.1" 149 | resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" 150 | integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== 151 | 152 | buffer-from@^1.0.0: 153 | version "1.1.2" 154 | resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" 155 | integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== 156 | 157 | callsites@^3.0.0: 158 | version "3.1.0" 159 | resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" 160 | integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== 161 | 162 | camelcase@^6.0.0: 163 | version "6.2.1" 164 | resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.1.tgz#250fd350cfd555d0d2160b1d51510eaf8326e86e" 165 | integrity sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA== 166 | 167 | chalk@^2.0.0: 168 | version "2.4.2" 169 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" 170 | integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== 171 | dependencies: 172 | ansi-styles "^3.2.1" 173 | escape-string-regexp "^1.0.5" 174 | supports-color "^5.3.0" 175 | 176 | chalk@^4.0.0, chalk@^4.1.0: 177 | version "4.1.2" 178 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" 179 | integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== 180 | dependencies: 181 | ansi-styles "^4.1.0" 182 | supports-color "^7.1.0" 183 | 184 | chokidar@3.5.2: 185 | version "3.5.2" 186 | resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" 187 | integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== 188 | dependencies: 189 | anymatch "~3.1.2" 190 | braces "~3.0.2" 191 | glob-parent "~5.1.2" 192 | is-binary-path "~2.1.0" 193 | is-glob "~4.0.1" 194 | normalize-path "~3.0.0" 195 | readdirp "~3.6.0" 196 | optionalDependencies: 197 | fsevents "~2.3.2" 198 | 199 | cliui@^7.0.2: 200 | version "7.0.4" 201 | resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" 202 | integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== 203 | dependencies: 204 | string-width "^4.2.0" 205 | strip-ansi "^6.0.0" 206 | wrap-ansi "^7.0.0" 207 | 208 | color-convert@^1.9.0: 209 | version "1.9.3" 210 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" 211 | integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== 212 | dependencies: 213 | color-name "1.1.3" 214 | 215 | color-convert@^2.0.1: 216 | version "2.0.1" 217 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" 218 | integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== 219 | dependencies: 220 | color-name "~1.1.4" 221 | 222 | color-name@1.1.3: 223 | version "1.1.3" 224 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" 225 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= 226 | 227 | color-name@~1.1.4: 228 | version "1.1.4" 229 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" 230 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== 231 | 232 | commander@^2.20.0: 233 | version "2.20.3" 234 | resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" 235 | integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== 236 | 237 | concat-map@0.0.1: 238 | version "0.0.1" 239 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 240 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= 241 | 242 | cross-spawn@^7.0.2: 243 | version "7.0.3" 244 | resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" 245 | integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== 246 | dependencies: 247 | path-key "^3.1.0" 248 | shebang-command "^2.0.0" 249 | which "^2.0.1" 250 | 251 | "d3-array@2 - 3": 252 | version "3.1.1" 253 | resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.1.1.tgz#7797eb53ead6b9083c75a45a681e93fc41bc468c" 254 | integrity sha512-33qQ+ZoZlli19IFiQx4QEpf2CBEayMRzhlisJHSCsSUbDXv6ZishqS1x7uFVClKG4Wr7rZVHvaAttoLow6GqdQ== 255 | dependencies: 256 | internmap "1 - 2" 257 | 258 | "d3-time@1 - 3": 259 | version "3.0.0" 260 | resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.0.0.tgz#65972cb98ae2d4954ef5c932e8704061335d4975" 261 | integrity sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ== 262 | dependencies: 263 | d3-array "2 - 3" 264 | 265 | debug@4.3.2: 266 | version "4.3.2" 267 | resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" 268 | integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== 269 | dependencies: 270 | ms "2.1.2" 271 | 272 | debug@^4.1.1, debug@^4.3.2: 273 | version "4.3.3" 274 | resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" 275 | integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== 276 | dependencies: 277 | ms "2.1.2" 278 | 279 | decamelize@^4.0.0: 280 | version "4.0.0" 281 | resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" 282 | integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== 283 | 284 | deep-is@^0.1.3: 285 | version "0.1.4" 286 | resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" 287 | integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== 288 | 289 | diff@5.0.0: 290 | version "5.0.0" 291 | resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" 292 | integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== 293 | 294 | doctrine@^3.0.0: 295 | version "3.0.0" 296 | resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" 297 | integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== 298 | dependencies: 299 | esutils "^2.0.2" 300 | 301 | emoji-regex@^8.0.0: 302 | version "8.0.0" 303 | resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" 304 | integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== 305 | 306 | enquirer@^2.3.5: 307 | version "2.3.6" 308 | resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" 309 | integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== 310 | dependencies: 311 | ansi-colors "^4.1.1" 312 | 313 | escalade@^3.1.1: 314 | version "3.1.1" 315 | resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" 316 | integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== 317 | 318 | escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: 319 | version "4.0.0" 320 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" 321 | integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== 322 | 323 | escape-string-regexp@^1.0.5: 324 | version "1.0.5" 325 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 326 | integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= 327 | 328 | eslint-scope@^7.1.0: 329 | version "7.1.0" 330 | resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.0.tgz#c1f6ea30ac583031f203d65c73e723b01298f153" 331 | integrity sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg== 332 | dependencies: 333 | esrecurse "^4.3.0" 334 | estraverse "^5.2.0" 335 | 336 | eslint-utils@^3.0.0: 337 | version "3.0.0" 338 | resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" 339 | integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== 340 | dependencies: 341 | eslint-visitor-keys "^2.0.0" 342 | 343 | eslint-visitor-keys@^2.0.0: 344 | version "2.1.0" 345 | resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" 346 | integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== 347 | 348 | eslint-visitor-keys@^3.1.0: 349 | version "3.1.0" 350 | resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz#eee4acea891814cda67a7d8812d9647dd0179af2" 351 | integrity sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA== 352 | 353 | eslint@8: 354 | version "8.4.0" 355 | resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.4.0.tgz#2fa01b271cafc28addc2719e551acff5e89f5230" 356 | integrity sha512-kv0XQcAQJL/VD9THQKhTQZVqkJKA+tIj/v2ZKNaIHRAADcJWFb+B/BAewUYuF6UVg1s2xC5qXVoDk0G8sKGeTA== 357 | dependencies: 358 | "@eslint/eslintrc" "^1.0.5" 359 | "@humanwhocodes/config-array" "^0.9.2" 360 | ajv "^6.10.0" 361 | chalk "^4.0.0" 362 | cross-spawn "^7.0.2" 363 | debug "^4.3.2" 364 | doctrine "^3.0.0" 365 | enquirer "^2.3.5" 366 | escape-string-regexp "^4.0.0" 367 | eslint-scope "^7.1.0" 368 | eslint-utils "^3.0.0" 369 | eslint-visitor-keys "^3.1.0" 370 | espree "^9.2.0" 371 | esquery "^1.4.0" 372 | esutils "^2.0.2" 373 | fast-deep-equal "^3.1.3" 374 | file-entry-cache "^6.0.1" 375 | functional-red-black-tree "^1.0.1" 376 | glob-parent "^6.0.1" 377 | globals "^13.6.0" 378 | ignore "^4.0.6" 379 | import-fresh "^3.0.0" 380 | imurmurhash "^0.1.4" 381 | is-glob "^4.0.0" 382 | js-yaml "^4.1.0" 383 | json-stable-stringify-without-jsonify "^1.0.1" 384 | levn "^0.4.1" 385 | lodash.merge "^4.6.2" 386 | minimatch "^3.0.4" 387 | natural-compare "^1.4.0" 388 | optionator "^0.9.1" 389 | progress "^2.0.0" 390 | regexpp "^3.2.0" 391 | semver "^7.2.1" 392 | strip-ansi "^6.0.1" 393 | strip-json-comments "^3.1.0" 394 | text-table "^0.2.0" 395 | v8-compile-cache "^2.0.3" 396 | 397 | espree@^9.2.0: 398 | version "9.2.0" 399 | resolved "https://registry.yarnpkg.com/espree/-/espree-9.2.0.tgz#c50814e01611c2d0f8bd4daa83c369eabba80dbc" 400 | integrity sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg== 401 | dependencies: 402 | acorn "^8.6.0" 403 | acorn-jsx "^5.3.1" 404 | eslint-visitor-keys "^3.1.0" 405 | 406 | esquery@^1.4.0: 407 | version "1.4.0" 408 | resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" 409 | integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== 410 | dependencies: 411 | estraverse "^5.1.0" 412 | 413 | esrecurse@^4.3.0: 414 | version "4.3.0" 415 | resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" 416 | integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== 417 | dependencies: 418 | estraverse "^5.2.0" 419 | 420 | estraverse@^5.1.0, estraverse@^5.2.0: 421 | version "5.3.0" 422 | resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" 423 | integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== 424 | 425 | esutils@^2.0.2: 426 | version "2.0.3" 427 | resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" 428 | integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== 429 | 430 | fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: 431 | version "3.1.3" 432 | resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" 433 | integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== 434 | 435 | fast-json-stable-stringify@^2.0.0: 436 | version "2.1.0" 437 | resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" 438 | integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== 439 | 440 | fast-levenshtein@^2.0.6: 441 | version "2.0.6" 442 | resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" 443 | integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= 444 | 445 | file-entry-cache@^6.0.1: 446 | version "6.0.1" 447 | resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" 448 | integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== 449 | dependencies: 450 | flat-cache "^3.0.4" 451 | 452 | fill-range@^7.0.1: 453 | version "7.0.1" 454 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" 455 | integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== 456 | dependencies: 457 | to-regex-range "^5.0.1" 458 | 459 | find-up@5.0.0: 460 | version "5.0.0" 461 | resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" 462 | integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== 463 | dependencies: 464 | locate-path "^6.0.0" 465 | path-exists "^4.0.0" 466 | 467 | flat-cache@^3.0.4: 468 | version "3.0.4" 469 | resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" 470 | integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== 471 | dependencies: 472 | flatted "^3.1.0" 473 | rimraf "^3.0.2" 474 | 475 | flat@^5.0.2: 476 | version "5.0.2" 477 | resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" 478 | integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== 479 | 480 | flatted@^3.1.0: 481 | version "3.2.4" 482 | resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.4.tgz#28d9969ea90661b5134259f312ab6aa7929ac5e2" 483 | integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw== 484 | 485 | fs.realpath@^1.0.0: 486 | version "1.0.0" 487 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 488 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= 489 | 490 | fsevents@~2.3.2: 491 | version "2.3.2" 492 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 493 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 494 | 495 | functional-red-black-tree@^1.0.1: 496 | version "1.0.1" 497 | resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" 498 | integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= 499 | 500 | get-caller-file@^2.0.5: 501 | version "2.0.5" 502 | resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" 503 | integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== 504 | 505 | glob-parent@^6.0.1: 506 | version "6.0.2" 507 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" 508 | integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== 509 | dependencies: 510 | is-glob "^4.0.3" 511 | 512 | glob-parent@~5.1.2: 513 | version "5.1.2" 514 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" 515 | integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== 516 | dependencies: 517 | is-glob "^4.0.1" 518 | 519 | glob@7.1.7: 520 | version "7.1.7" 521 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" 522 | integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== 523 | dependencies: 524 | fs.realpath "^1.0.0" 525 | inflight "^1.0.4" 526 | inherits "2" 527 | minimatch "^3.0.4" 528 | once "^1.3.0" 529 | path-is-absolute "^1.0.0" 530 | 531 | glob@^7.1.3: 532 | version "7.2.0" 533 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" 534 | integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== 535 | dependencies: 536 | fs.realpath "^1.0.0" 537 | inflight "^1.0.4" 538 | inherits "2" 539 | minimatch "^3.0.4" 540 | once "^1.3.0" 541 | path-is-absolute "^1.0.0" 542 | 543 | globals@^13.6.0, globals@^13.9.0: 544 | version "13.12.0" 545 | resolved "https://registry.yarnpkg.com/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" 546 | integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== 547 | dependencies: 548 | type-fest "^0.20.2" 549 | 550 | growl@1.10.5: 551 | version "1.10.5" 552 | resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" 553 | integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== 554 | 555 | has-flag@^3.0.0: 556 | version "3.0.0" 557 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" 558 | integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= 559 | 560 | has-flag@^4.0.0: 561 | version "4.0.0" 562 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" 563 | integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== 564 | 565 | he@1.2.0: 566 | version "1.2.0" 567 | resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" 568 | integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== 569 | 570 | ignore@^4.0.6: 571 | version "4.0.6" 572 | resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" 573 | integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== 574 | 575 | import-fresh@^3.0.0, import-fresh@^3.2.1: 576 | version "3.3.0" 577 | resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" 578 | integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== 579 | dependencies: 580 | parent-module "^1.0.0" 581 | resolve-from "^4.0.0" 582 | 583 | imurmurhash@^0.1.4: 584 | version "0.1.4" 585 | resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" 586 | integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= 587 | 588 | inflight@^1.0.4: 589 | version "1.0.6" 590 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 591 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= 592 | dependencies: 593 | once "^1.3.0" 594 | wrappy "1" 595 | 596 | inherits@2: 597 | version "2.0.4" 598 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 599 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 600 | 601 | "internmap@1 - 2": 602 | version "2.0.3" 603 | resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" 604 | integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== 605 | 606 | is-binary-path@~2.1.0: 607 | version "2.1.0" 608 | resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" 609 | integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== 610 | dependencies: 611 | binary-extensions "^2.0.0" 612 | 613 | is-extglob@^2.1.1: 614 | version "2.1.1" 615 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" 616 | integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= 617 | 618 | is-fullwidth-code-point@^3.0.0: 619 | version "3.0.0" 620 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" 621 | integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== 622 | 623 | is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: 624 | version "4.0.3" 625 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" 626 | integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== 627 | dependencies: 628 | is-extglob "^2.1.1" 629 | 630 | is-number@^7.0.0: 631 | version "7.0.0" 632 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" 633 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== 634 | 635 | is-plain-obj@^2.1.0: 636 | version "2.1.0" 637 | resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" 638 | integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== 639 | 640 | is-unicode-supported@^0.1.0: 641 | version "0.1.0" 642 | resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" 643 | integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== 644 | 645 | isexe@^2.0.0: 646 | version "2.0.0" 647 | resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" 648 | integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= 649 | 650 | jest-worker@^26.2.1: 651 | version "26.6.2" 652 | resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" 653 | integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== 654 | dependencies: 655 | "@types/node" "*" 656 | merge-stream "^2.0.0" 657 | supports-color "^7.0.0" 658 | 659 | js-tokens@^4.0.0: 660 | version "4.0.0" 661 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" 662 | integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== 663 | 664 | js-yaml@4.1.0, js-yaml@^4.1.0: 665 | version "4.1.0" 666 | resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" 667 | integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== 668 | dependencies: 669 | argparse "^2.0.1" 670 | 671 | json-schema-traverse@^0.4.1: 672 | version "0.4.1" 673 | resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" 674 | integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== 675 | 676 | json-stable-stringify-without-jsonify@^1.0.1: 677 | version "1.0.1" 678 | resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" 679 | integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= 680 | 681 | levn@^0.4.1: 682 | version "0.4.1" 683 | resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" 684 | integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== 685 | dependencies: 686 | prelude-ls "^1.2.1" 687 | type-check "~0.4.0" 688 | 689 | locate-path@^6.0.0: 690 | version "6.0.0" 691 | resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" 692 | integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== 693 | dependencies: 694 | p-locate "^5.0.0" 695 | 696 | lodash.merge@^4.6.2: 697 | version "4.6.2" 698 | resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" 699 | integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== 700 | 701 | log-symbols@4.1.0: 702 | version "4.1.0" 703 | resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" 704 | integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== 705 | dependencies: 706 | chalk "^4.1.0" 707 | is-unicode-supported "^0.1.0" 708 | 709 | lru-cache@^6.0.0: 710 | version "6.0.0" 711 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" 712 | integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== 713 | dependencies: 714 | yallist "^4.0.0" 715 | 716 | merge-stream@^2.0.0: 717 | version "2.0.0" 718 | resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" 719 | integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== 720 | 721 | minimatch@3.0.4, minimatch@^3.0.4: 722 | version "3.0.4" 723 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" 724 | integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== 725 | dependencies: 726 | brace-expansion "^1.1.7" 727 | 728 | mocha@9: 729 | version "9.1.3" 730 | resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.1.3.tgz#8a623be6b323810493d8c8f6f7667440fa469fdb" 731 | integrity sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw== 732 | dependencies: 733 | "@ungap/promise-all-settled" "1.1.2" 734 | ansi-colors "4.1.1" 735 | browser-stdout "1.3.1" 736 | chokidar "3.5.2" 737 | debug "4.3.2" 738 | diff "5.0.0" 739 | escape-string-regexp "4.0.0" 740 | find-up "5.0.0" 741 | glob "7.1.7" 742 | growl "1.10.5" 743 | he "1.2.0" 744 | js-yaml "4.1.0" 745 | log-symbols "4.1.0" 746 | minimatch "3.0.4" 747 | ms "2.1.3" 748 | nanoid "3.1.25" 749 | serialize-javascript "6.0.0" 750 | strip-json-comments "3.1.1" 751 | supports-color "8.1.1" 752 | which "2.0.2" 753 | workerpool "6.1.5" 754 | yargs "16.2.0" 755 | yargs-parser "20.2.4" 756 | yargs-unparser "2.0.0" 757 | 758 | ms@2.1.2: 759 | version "2.1.2" 760 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" 761 | integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== 762 | 763 | ms@2.1.3: 764 | version "2.1.3" 765 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" 766 | integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== 767 | 768 | nanoid@3.1.25: 769 | version "3.1.25" 770 | resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152" 771 | integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q== 772 | 773 | natural-compare@^1.4.0: 774 | version "1.4.0" 775 | resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" 776 | integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= 777 | 778 | normalize-path@^3.0.0, normalize-path@~3.0.0: 779 | version "3.0.0" 780 | resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" 781 | integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== 782 | 783 | once@^1.3.0: 784 | version "1.4.0" 785 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 786 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 787 | dependencies: 788 | wrappy "1" 789 | 790 | optionator@^0.9.1: 791 | version "0.9.1" 792 | resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" 793 | integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== 794 | dependencies: 795 | deep-is "^0.1.3" 796 | fast-levenshtein "^2.0.6" 797 | levn "^0.4.1" 798 | prelude-ls "^1.2.1" 799 | type-check "^0.4.0" 800 | word-wrap "^1.2.3" 801 | 802 | p-limit@^3.0.2: 803 | version "3.1.0" 804 | resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" 805 | integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== 806 | dependencies: 807 | yocto-queue "^0.1.0" 808 | 809 | p-locate@^5.0.0: 810 | version "5.0.0" 811 | resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" 812 | integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== 813 | dependencies: 814 | p-limit "^3.0.2" 815 | 816 | parent-module@^1.0.0: 817 | version "1.0.1" 818 | resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" 819 | integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== 820 | dependencies: 821 | callsites "^3.0.0" 822 | 823 | path-exists@^4.0.0: 824 | version "4.0.0" 825 | resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" 826 | integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== 827 | 828 | path-is-absolute@^1.0.0: 829 | version "1.0.1" 830 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 831 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= 832 | 833 | path-key@^3.1.0: 834 | version "3.1.1" 835 | resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" 836 | integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== 837 | 838 | picomatch@^2.0.4, picomatch@^2.2.1: 839 | version "2.3.0" 840 | resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" 841 | integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== 842 | 843 | prelude-ls@^1.2.1: 844 | version "1.2.1" 845 | resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" 846 | integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== 847 | 848 | progress@^2.0.0: 849 | version "2.0.3" 850 | resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" 851 | integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== 852 | 853 | punycode@^2.1.0: 854 | version "2.1.1" 855 | resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" 856 | integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== 857 | 858 | randombytes@^2.1.0: 859 | version "2.1.0" 860 | resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" 861 | integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== 862 | dependencies: 863 | safe-buffer "^5.1.0" 864 | 865 | readdirp@~3.6.0: 866 | version "3.6.0" 867 | resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" 868 | integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== 869 | dependencies: 870 | picomatch "^2.2.1" 871 | 872 | regexpp@^3.2.0: 873 | version "3.2.0" 874 | resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" 875 | integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== 876 | 877 | require-directory@^2.1.1: 878 | version "2.1.1" 879 | resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" 880 | integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= 881 | 882 | resolve-from@^4.0.0: 883 | version "4.0.0" 884 | resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" 885 | integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== 886 | 887 | rimraf@^3.0.2: 888 | version "3.0.2" 889 | resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" 890 | integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== 891 | dependencies: 892 | glob "^7.1.3" 893 | 894 | rollup-plugin-terser@7: 895 | version "7.0.2" 896 | resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" 897 | integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== 898 | dependencies: 899 | "@babel/code-frame" "^7.10.4" 900 | jest-worker "^26.2.1" 901 | serialize-javascript "^4.0.0" 902 | terser "^5.0.0" 903 | 904 | rollup@2: 905 | version "2.60.2" 906 | resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.60.2.tgz#3f45ace36a9b10b4297181831ea0719922513463" 907 | integrity sha512-1Bgjpq61sPjgoZzuiDSGvbI1tD91giZABgjCQBKM5aYLnzjq52GoDuWVwT/cm/MCxCMPU8gqQvkj8doQ5C8Oqw== 908 | optionalDependencies: 909 | fsevents "~2.3.2" 910 | 911 | safe-buffer@^5.1.0: 912 | version "5.2.1" 913 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 914 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 915 | 916 | semver@^7.2.1: 917 | version "7.3.5" 918 | resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" 919 | integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== 920 | dependencies: 921 | lru-cache "^6.0.0" 922 | 923 | serialize-javascript@6.0.0: 924 | version "6.0.0" 925 | resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" 926 | integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== 927 | dependencies: 928 | randombytes "^2.1.0" 929 | 930 | serialize-javascript@^4.0.0: 931 | version "4.0.0" 932 | resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" 933 | integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== 934 | dependencies: 935 | randombytes "^2.1.0" 936 | 937 | shebang-command@^2.0.0: 938 | version "2.0.0" 939 | resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" 940 | integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== 941 | dependencies: 942 | shebang-regex "^3.0.0" 943 | 944 | shebang-regex@^3.0.0: 945 | version "3.0.0" 946 | resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" 947 | integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== 948 | 949 | source-map-support@~0.5.20: 950 | version "0.5.21" 951 | resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" 952 | integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== 953 | dependencies: 954 | buffer-from "^1.0.0" 955 | source-map "^0.6.0" 956 | 957 | source-map@^0.6.0: 958 | version "0.6.1" 959 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 960 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 961 | 962 | source-map@~0.7.2: 963 | version "0.7.3" 964 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" 965 | integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== 966 | 967 | string-width@^4.1.0, string-width@^4.2.0: 968 | version "4.2.3" 969 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" 970 | integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== 971 | dependencies: 972 | emoji-regex "^8.0.0" 973 | is-fullwidth-code-point "^3.0.0" 974 | strip-ansi "^6.0.1" 975 | 976 | strip-ansi@^6.0.0, strip-ansi@^6.0.1: 977 | version "6.0.1" 978 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" 979 | integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== 980 | dependencies: 981 | ansi-regex "^5.0.1" 982 | 983 | strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: 984 | version "3.1.1" 985 | resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" 986 | integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== 987 | 988 | supports-color@8.1.1: 989 | version "8.1.1" 990 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" 991 | integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== 992 | dependencies: 993 | has-flag "^4.0.0" 994 | 995 | supports-color@^5.3.0: 996 | version "5.5.0" 997 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" 998 | integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== 999 | dependencies: 1000 | has-flag "^3.0.0" 1001 | 1002 | supports-color@^7.0.0, supports-color@^7.1.0: 1003 | version "7.2.0" 1004 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" 1005 | integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== 1006 | dependencies: 1007 | has-flag "^4.0.0" 1008 | 1009 | terser@^5.0.0: 1010 | version "5.10.0" 1011 | resolved "https://registry.yarnpkg.com/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc" 1012 | integrity sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA== 1013 | dependencies: 1014 | commander "^2.20.0" 1015 | source-map "~0.7.2" 1016 | source-map-support "~0.5.20" 1017 | 1018 | text-table@^0.2.0: 1019 | version "0.2.0" 1020 | resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" 1021 | integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= 1022 | 1023 | to-regex-range@^5.0.1: 1024 | version "5.0.1" 1025 | resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" 1026 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== 1027 | dependencies: 1028 | is-number "^7.0.0" 1029 | 1030 | type-check@^0.4.0, type-check@~0.4.0: 1031 | version "0.4.0" 1032 | resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" 1033 | integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== 1034 | dependencies: 1035 | prelude-ls "^1.2.1" 1036 | 1037 | type-fest@^0.20.2: 1038 | version "0.20.2" 1039 | resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" 1040 | integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== 1041 | 1042 | uri-js@^4.2.2: 1043 | version "4.4.1" 1044 | resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" 1045 | integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== 1046 | dependencies: 1047 | punycode "^2.1.0" 1048 | 1049 | v8-compile-cache@^2.0.3: 1050 | version "2.3.0" 1051 | resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" 1052 | integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== 1053 | 1054 | which@2.0.2, which@^2.0.1: 1055 | version "2.0.2" 1056 | resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" 1057 | integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== 1058 | dependencies: 1059 | isexe "^2.0.0" 1060 | 1061 | word-wrap@^1.2.3: 1062 | version "1.2.3" 1063 | resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" 1064 | integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== 1065 | 1066 | workerpool@6.1.5: 1067 | version "6.1.5" 1068 | resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.5.tgz#0f7cf076b6215fd7e1da903ff6f22ddd1886b581" 1069 | integrity sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw== 1070 | 1071 | wrap-ansi@^7.0.0: 1072 | version "7.0.0" 1073 | resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" 1074 | integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== 1075 | dependencies: 1076 | ansi-styles "^4.0.0" 1077 | string-width "^4.1.0" 1078 | strip-ansi "^6.0.0" 1079 | 1080 | wrappy@1: 1081 | version "1.0.2" 1082 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 1083 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 1084 | 1085 | y18n@^5.0.5: 1086 | version "5.0.8" 1087 | resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" 1088 | integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== 1089 | 1090 | yallist@^4.0.0: 1091 | version "4.0.0" 1092 | resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" 1093 | integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== 1094 | 1095 | yargs-parser@20.2.4: 1096 | version "20.2.4" 1097 | resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" 1098 | integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== 1099 | 1100 | yargs-parser@^20.2.2: 1101 | version "20.2.9" 1102 | resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" 1103 | integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== 1104 | 1105 | yargs-unparser@2.0.0: 1106 | version "2.0.0" 1107 | resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" 1108 | integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== 1109 | dependencies: 1110 | camelcase "^6.0.0" 1111 | decamelize "^4.0.0" 1112 | flat "^5.0.2" 1113 | is-plain-obj "^2.1.0" 1114 | 1115 | yargs@16.2.0: 1116 | version "16.2.0" 1117 | resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" 1118 | integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== 1119 | dependencies: 1120 | cliui "^7.0.2" 1121 | escalade "^3.1.1" 1122 | get-caller-file "^2.0.5" 1123 | require-directory "^2.1.1" 1124 | string-width "^4.2.0" 1125 | y18n "^5.0.5" 1126 | yargs-parser "^20.2.2" 1127 | 1128 | yocto-queue@^0.1.0: 1129 | version "0.1.0" 1130 | resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" 1131 | integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== 1132 | --------------------------------------------------------------------------------