Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update date-fns to v3 #265

Merged
merged 6 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .babelrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const presets = []
const presets = ['@babel/preset-env']
christopherklint97 marked this conversation as resolved.
Show resolved Hide resolved
const plugins = [
'@babel/plugin-transform-block-scoping',
'@babel/plugin-transform-template-literals',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-parameters',
'@babel/plugin-transform-destructuring',
'@babel/plugin-transform-optional-chaining',
'@babel/plugin-transform-logical-assignment-operators',
]

if (process.env.NODE_ENV === 'test') {
Expand Down
874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions .yarn/releases/yarn-berry.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://github.com/mskelton/yarn-plugin-outdated/raw/v2.1.1/bundles/@yarnpkg/plugin-outdated.js"

yarnPath: .yarn/releases/yarn-berry.cjs
yarnPath: .yarn/releases/yarn-3.6.4.cjs
18 changes: 17 additions & 1 deletion config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ const config = {
entry: getEntryConfig(),
output: getOutputConfig(),
module: {
rules: [{ test: /\.js$/, exclude: /node_modules/, use: 'babel-loader' }].concat(
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!date-fns)/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: 'defaults' }]],
plugins: [
'@babel/plugin-transform-optional-chaining',
'@babel/plugin-transform-logical-assignment-operators',
'@babel/plugin-transform-nullish-coalescing-operator',
],
},
},
},
].concat(
process.env.COVERAGE_REPORT
? [
{
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "date-fns-tz",
"version": "2.0.0",
"version": "3.0.0",
"sideEffects": false,
"description": "Time zone support for date-fns v2 with the Intl API",
"description": "Time zone support for date-fns v3 with the Intl API",
"author": "Marnus Weststrate <marnusw@gmail.com>",
"license": "MIT",
"keywords": [
Expand Down Expand Up @@ -120,7 +120,7 @@
]
},
"peerDependencies": {
"date-fns": ">=2.0.0"
"date-fns": "^3.0.0"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
Expand All @@ -129,25 +129,29 @@
"@babel/plugin-transform-arrow-functions": "^7.14.5",
"@babel/plugin-transform-block-scoping": "^7.15.3",
"@babel/plugin-transform-destructuring": "^7.14.7",
"@babel/plugin-transform-logical-assignment-operators": "^7.23.4",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/plugin-transform-optional-chaining": "^7.21.0",
"@babel/plugin-transform-parameters": "^7.4.4",
"@babel/plugin-transform-template-literals": "^7.4.4",
"@babel/preset-env": "^7.23.6",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-power-assert": "^3.0.0",
"cross-env": "^7.0.3",
"date-fns": "^2.23.0",
"date-fns": "^3.0.6",
"eslint": "^7.11.0",
"eslint-config-prettier": "^7.2.0",
"flow-bin": "^0.143.1",
"fs-promise": "^2.0.3",
"husky": "^4.3.0",
"jsdoc-to-markdown": "^7.0.1",
"json-loader": "^0.5.7",
"karma": "^3.1.4",
"karma": "^6.3.16",
"karma-benchmark": "^1.0.4",
"karma-benchmark-reporter": "^0.1.1",
"karma-chrome-launcher": "2.2",
Expand All @@ -160,7 +164,7 @@
"lint-staged": "^10.4.0",
"lodash": "^4.17.15",
"lodash.clonedeep": "^4.5.0",
christopherklint97 marked this conversation as resolved.
Show resolved Hide resolved
"mocha": "^6.2.1",
"mocha": "^10.1.0",
"power-assert": "^1.6.1",
"prettier": "^2.2.1",
"typescript": "^4.1.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/fp.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getFPFn(resultFnName, initialFnName, arity) {
return [generatedAutomaticallyMessage]
.concat('')
.concat(`import fn from '../../${initialFnName}/index.js'`)
.concat(`import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'`)
.concat(`import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'`)
.concat('')
.concat(`var ${resultFnName} = convertToFP(fn, ${arity})`)
.concat('')
Expand Down
2 changes: 1 addition & 1 deletion src/format/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dateFnsFormat from 'date-fns/format/index.js'
import { format as dateFnsFormat } from 'date-fns/format.js'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { format as dateFnsFormat } from 'date-fns/format.js'
import { format as dateFnsFormat } from 'date-fns'

To avoid any further path change, maybe we should refer to global package ? It works and it's not path-specific, so more secure (imho).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about this as well, but when I try to do this then I get errors.. 🤔

$ yarn test

START:
ℹ 「wdm」: Built at: 01/08/2024 8:58:09 AM
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
✖ 「wdm」: Built at: 01/08/2024 8:58:11 AM
Entrypoint ../test = ../test.js
[./node_modules/date-fns/index.mjs] 8.8 KiB {../test} [built]
[./node_modules/date-fns/locale/en-GB.js] 772 bytes {../test} [built]
[./node_modules/power-assert/index.js] 2.2 KiB {../test} [built]
[./src sync recursive \/test\.js$] ./src sync \/test\.js$ 460 bytes {../test} [built]
[./src/_lib/newDateUTC/test.js] 36.4 KiB {../test} [optional] [built]
[./src/_lib/tzIntlTimeZoneName/test.js] 22.4 KiB {../test} [optional] [built]
[./src/_lib/tzParseTimezone/test.js] 127 KiB {../test} [optional] [built]
[./src/_lib/tzTokenizeDate/test.js] 31.8 KiB {../test} [optional] [built]
[./src/format/test.js] 171 KiB {../test} [optional] [built]
[./src/formatInTimeZone/test.js] 16.4 KiB {../test} [optional] [built]
[./src/getTimezoneOffset/test.js] 100 KiB {../test} [optional] [built]
[./src/toDate/test.js] 255 KiB {../test} [optional] [built]
[./src/utcToZonedTime/test.js] 53.5 KiB {../test} [optional] [built]
[./src/zonedTimeToUtc/test.js] 89.8 KiB {../test} [optional] [built]
[./test.js] 124 bytes {../test} [built]
    + 510 hidden modules

WARNING in ./node_modules/power-assert-formatter/lib/create.js 30:28-49
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/power-assert-formatter/index.js
 @ ./node_modules/power-assert/index.js
 @ ./src/getTimezoneOffset/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 96:9-27
Can't import the named export 'AMPMMidnightParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 95:9-19
Can't import the named export 'AMPMParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 89:9-19
Can't import the named export 'DateParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse.mjs 352:23-49
Can't import the named export 'DateToSystemTimezoneSetter' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 90:9-24
Can't import the named export 'DayOfYearParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 91:9-18
Can't import the named export 'DayParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 97:9-24
Can't import the named export 'DayPeriodParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 78:9-18
Can't import the named export 'EraParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 82:9-27
Can't import the named export 'ExtendedYearParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 104:9-31
Can't import the named export 'FractionOfSecondParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 100:9-24
Can't import the named export 'Hour0To11Parser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 99:9-24
Can't import the named export 'Hour0to23Parser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 101:9-24
Can't import the named export 'Hour1To24Parser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 98:9-24
Can't import the named export 'Hour1to12Parser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 94:9-21
Can't import the named export 'ISODayParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 106:9-26
Can't import the named export 'ISOTimezoneParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 105:9-31
Can't import the named export 'ISOTimezoneWithZParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 88:9-22
Can't import the named export 'ISOWeekParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 81:9-26
Can't import the named export 'ISOWeekYearParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 92:9-23
Can't import the named export 'LocalDayParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 87:9-24
Can't import the named export 'LocalWeekParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 80:9-28
Can't import the named export 'LocalWeekYearParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 102:9-21
Can't import the named export 'MinuteParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 85:9-20
Can't import the named export 'MonthParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 83:9-22
Can't import the named export 'QuarterParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 103:9-21
Can't import the named export 'SecondParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 93:9-33
Can't import the named export 'StandAloneLocalDayParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 86:9-30
Can't import the named export 'StandAloneMonthParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 84:9-32
Can't import the named export 'StandAloneQuarterParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 108:9-36
Can't import the named export 'TimestampMillisecondsParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 107:9-31
Can't import the named export 'TimestampSecondsParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers.mjs 79:9-19
Can't import the named export 'YearParser' from non EcmaScript module (only default export is available)
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/YearParser.mjs 13:11
Module parse failed: Unexpected token (13:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
| export class YearParser extends Parser {
>   priority = 130;
|   incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
|   parse(dateString, token, match) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 2:0-54 79:9-19
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/EraParser.mjs 3:11
Module parse failed: Unexpected token (3:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { Parser } from "../Parser.mjs";
| export class EraParser extends Parser {
>   priority = 140;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 1:0-52 78:9-18
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { dayPeriodEnumToHours } from "../utils.mjs";
| export class AMPMMidnightParser extends Parser {
>   priority = 80;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 19:0-70 96:9-27
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/AMPMParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { dayPeriodEnumToHours } from "../utils.mjs";
| export class AMPMParser extends Parser {
>   priority = 80;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 18:0-54 95:9-19
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { mapValue, parseNDigits } from "../utils.mjs";
| export class FractionOfSecondParser extends Parser {
>   priority = 30;
|   parse(dateString, token) {
|     const valueCallback = value => Math.floor(value * Math.pow(10, -token.length + 3));
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 27:0-78 104:9-31
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/QuarterParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits } from "../utils.mjs";
| export class QuarterParser extends Parser {
>   priority = 120;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 6:0-60 83:9-22
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits } from "../utils.mjs";
| export class StandAloneQuarterParser extends Parser {
>   priority = 120;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 7:0-80 84:9-32
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.mjs 4:11
Module parse failed: Unexpected token (4:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigitsSigned } from "../utils.mjs";
| export class ExtendedYearParser extends Parser {
>   priority = 130;
|   parse(dateString, token) {
|     if (token === "u") {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 5:0-70 82:9-27
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { isLeapYearIndex, parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class DayOfYearParser extends Parser {
>   priority = 90;
|   subpriority = 1;
|   parse(dateString, token, match) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 13:0-64 90:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { mapValue, parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class StandAloneMonthParser extends Parser {
>   priority = 110;
|   parse(dateString, token, match) {
|     const valueCallback = value => value - 1;
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 9:0-76 86:9-30
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseAnyDigitsSigned } from "../utils.mjs";
| export class TimestampMillisecondsParser extends Parser {
>   priority = 20;
|   parse(dateString) {
|     return parseAnyDigitsSigned(dateString);
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 31:0-88 108:9-36
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseAnyDigitsSigned } from "../utils.mjs";
| export class TimestampSecondsParser extends Parser {
>   priority = 40;
|   parse(dateString) {
|     return parseAnyDigitsSigned(dateString);
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 30:0-78 107:9-31
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class Hour0To11Parser extends Parser {
>   priority = 70;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 23:0-64 100:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class Hour0to23Parser extends Parser {
>   priority = 70;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 22:0-64 99:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class Hour1To24Parser extends Parser {
>   priority = 70;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 24:0-64 101:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class Hour1to12Parser extends Parser {
>   priority = 70;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 21:0-64 98:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/MinuteParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class MinuteParser extends Parser {
>   priority = 60;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 25:0-58 102:9-21
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/SecondParser.mjs 5:11
Module parse failed: Unexpected token (5:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class SecondParser extends Parser {
>   priority = 50;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 26:0-58 103:9-21
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/Setter.mjs 5:14
Module parse failed: Unexpected token (5:14)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| const TIMEZONE_UNIT_PRIORITY = 10;
| export class Setter {
>   subPriority = 0;
|   validate(_utcDate, _options) {
|     return true;
 @ ./node_modules/date-fns/parse.mjs 8:0-69 352:23-49
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/MonthParser.mjs 5:21
Module parse failed: Unexpected token (5:21)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { mapValue, parseNDigits, parseNumericPattern } from "../utils.mjs";
| export class MonthParser extends Parser {
>   incompatibleTokens = ["Y", "R", "q", "Q", "L", "w", "I", "D", "i", "e", "c", "t", "T"];
|   priority = 110;
|   parse(dateString, token, match) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 8:0-56 85:9-20
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/DayParser.mjs 6:11
Module parse failed: Unexpected token (6:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Day of week
| export class DayParser extends Parser {
>   priority = 90;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 14:0-52 91:9-18
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.mjs 6:11
Module parse failed: Unexpected token (6:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // in the morning, in the afternoon, in the evening, at night
| export class DayPeriodParser extends Parser {
>   priority = 80;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 20:0-64 97:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ISODayParser.mjs 7:11
Module parse failed: Unexpected token (7:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // ISO day of week
| export class ISODayParser extends Parser {
>   priority = 90;
|   parse(dateString, token, match) {
|     const valueCallback = value => {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 17:0-58 94:9-21
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/LocalDayParser.mjs 7:11
Module parse failed: Unexpected token (7:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Local day of week
| export class LocalDayParser extends Parser {
>   priority = 90;
|   parse(dateString, token, match, options) {
|     const valueCallback = value => {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 15:0-62 92:9-23
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.mjs 7:11
Module parse failed: Unexpected token (7:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Stand-alone local day of week
| export class StandAloneLocalDayParser extends Parser {
>   priority = 90;
|   parse(dateString, token, match, options) {
|     const valueCallback = value => {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 16:0-82 93:9-33
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.mjs 8:11
Module parse failed: Unexpected token (8:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // ISO week-numbering year
| export class ISOWeekYearParser extends Parser {
>   priority = 130;
|   parse(dateString, token) {
|     if (token === "R") {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 4:0-68 81:9-26
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.mjs 8:11
Module parse failed: Unexpected token (8:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Local week-numbering year
| export class LocalWeekYearParser extends Parser {
>   priority = 130;
|   parse(dateString, token, match) {
|     const valueCallback = year => ({
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 3:0-72 80:9-28
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/DateParser.mjs 9:11
Module parse failed: Unexpected token (9:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Day of the month
| export class DateParser extends Parser {
>   priority = 90;
|   subPriority = 1;
|   parse(dateString, token, match) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 12:0-54 89:9-19
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.mjs 9:11
Module parse failed: Unexpected token (9:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // ISO week of year
| export class ISOWeekParser extends Parser {
>   priority = 100;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 11:0-60 88:9-22
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.mjs 9:11
Module parse failed: Unexpected token (9:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Local week of year
| export class LocalWeekParser extends Parser {
>   priority = 100;
|   parse(dateString, token, match) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 10:0-64 87:9-24
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.mjs 9:11
Module parse failed: Unexpected token (9:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Timezone (ISO-8601)
| export class ISOTimezoneParser extends Parser {
>   priority = 10;
|   parse(dateString, token) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 29:0-68 106:9-26
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js

ERROR in ./node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.mjs 9:11
Module parse failed: Unexpected token (9:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| // Timezone (ISO-8601. +00:00 is `'Z'`)
| export class ISOTimezoneWithZParser extends Parser {
>   priority = 10;
|   parse(dateString, token) {
|     switch (token) {
 @ ./node_modules/date-fns/parse/_lib/parsers.mjs 28:0-78 105:9-31
 @ ./node_modules/date-fns/parse.mjs
 @ ./node_modules/date-fns/index.mjs
 @ ./src/utcToZonedTime/test.js
 @ ./src sync \/test\.js$
 @ ./test.js
ℹ 「wdm」: Failed to compile.
08 01 2024 08:58:11.335:INFO [karma-server]: Karma v6.4.2 server started at http://localhost:9876/
08 01 2024 08:58:11.335:INFO [launcher]: Launching browsers LocalChrome with concurrency unlimited
08 01 2024 08:58:11.339:INFO [launcher]: Starting browser Chrome
08 01 2024 08:58:15.698:INFO [Chrome 120.0.0.0 (Mac OS 10.15.7)]: Connected on socket M-sl7g7Es8dIyBjSAAAB with id 52467360
Chrome 120.0.0.0 (Mac OS 10.15.7) ERROR
  Uncaught Error: Module parse failed: Unexpected token (3:11)
  File was processed with these loaders:
   * ./node_modules/babel-loader/lib/index.js
  You may need an additional loader to handle the result of these loaders.
  | import { Parser } from "../Parser.mjs";
  | export class EraParser extends Parser {
  >   priority = 140;
  |   parse(dateString, token, match) {
  |     switch (token) {
  at /Users/christopherklint/coding/date-fns-tz/test.js:21074:1

  Error: Module parse failed: Unexpected token (3:11)
  File was processed with these loaders:
   * ./node_modules/babel-loader/lib/index.js
  You may need an additional loader to handle the result of these loaders.
  | import { Parser } from "../Parser.mjs";
  | export class EraParser extends Parser {
  >   priority = 140;
  |   parse(dateString, token, match) {
  |     switch (token) {
      at ./node_modules/date-fns/parse/_lib/parsers/EraParser.mjs (/Users/christopherklint/coding/date-fns-tz/test.js:21074:7)
      at __webpack_require__ (webpack:///webpack/bootstrap:19:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20:30)
      at ./node_modules/date-fns/parse/_lib/parsers.mjs (webpack:///node_modules/date-fns/parse/_lib/parsers.mjs:1:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20858:80)
      at __webpack_require__ (webpack:///webpack/bootstrap:19:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20:30)
      at ./node_modules/date-fns/parse.mjs (webpack:///node_modules/date-fns/parse.mjs:1:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20387:80)
      at __webpack_require__ (webpack:///webpack/bootstrap:19:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20:30)
      at ./node_modules/date-fns/isMatch.mjs (webpack:///node_modules/date-fns/isMatch.mjs:1:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:15953:68)
      at __webpack_require__ (webpack:///webpack/bootstrap:19:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20:30)
      at ./node_modules/date-fns/index.mjs (webpack:///node_modules/date-fns/index.mjs:1:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:14389:72)
      at __webpack_require__ (webpack:///webpack/bootstrap:19:1 <- /Users/christopherklint/coding/date-fns-tz/test.js:20:30)

Finished in 0.138 secs / 0 secs @ 08:58:15 GMT+0100 (GMT+01:00)

SUMMARY:
✔ 0 tests completed

import formatters from './formatters/index.js'
import toDate from '../toDate/index.js'

Expand Down
10 changes: 5 additions & 5 deletions src/format/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import assert from 'power-assert'
import format from '.'
import enGB from 'date-fns/locale/en-GB'
import enGB from 'date-fns/locale/en-GB.js'
import utcToZonedTime from '../utcToZonedTime'

describe('format', function () {
Expand Down Expand Up @@ -888,7 +888,7 @@ describe('format', function () {
assert.throws(block, RangeError)
assert.throws(
block,
/(Use `d` instead of `D` \(in `yyyy-MM-D`\) for formatting days of the month to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/git.io\/fxCyr)/g
/(Use `d` instead of `D` \(in `yyyy-MM-D`\) for formatting days of the month to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/github.com\/date-fns\/date-fns\/blob\/master\/docs\/unicodeTokens.md)/g
)
})

Expand All @@ -904,7 +904,7 @@ describe('format', function () {
assert.throws(block, RangeError)
assert.throws(
block,
/(Use `dd` instead of `DD` \(in `yyyy-MM-DD`\) for formatting days of the month to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/git.io\/fxCyr)/g
/(Use `dd` instead of `DD` \(in `yyyy-MM-DD`\) for formatting days of the month to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/github.com\/date-fns\/date-fns\/blob\/master\/docs\/unicodeTokens.md)/g
)
})

Expand All @@ -920,7 +920,7 @@ describe('format', function () {
assert.throws(block, RangeError)
assert.throws(
block,
/(Use `yy` instead of `YY` \(in `YY-MM-dd`\) for formatting years to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/git.io\/fxCyr)/g
/(Use `yy` instead of `YY` \(in `YY-MM-dd`\) for formatting years to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/github.com\/date-fns\/date-fns\/blob\/master\/docs\/unicodeTokens.md)/g
)
})

Expand All @@ -936,7 +936,7 @@ describe('format', function () {
assert.throws(block, RangeError)
assert.throws(
block,
/(Use `yyyy` instead of `YYYY` \(in `YYYY-MM-dd`\) for formatting years to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/git.io\/fxCyr)/g
/(Use `yyyy` instead of `YYYY` \(in `YYYY-MM-dd`\) for formatting years to the input `Fri Apr 04 1986 10:32:55).*(`; see: https:\/\/github.com\/date-fns\/date-fns\/blob\/master\/docs\/unicodeTokens.md)/g
)
})

Expand Down
4 changes: 2 additions & 2 deletions src/formatInTimeZone/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cloneObject from 'date-fns/_lib/cloneObject/index.js'
import format from '../format/index.js'
import utcToZonedTime from '../utcToZonedTime/index.js'
import cloneDeep from 'lodash.clonedeep'

/**
* @name formatInTimeZone
Expand All @@ -25,7 +25,7 @@ import utcToZonedTime from '../utcToZonedTime/index.js'
* @returns {String} the formatted date string
*/
export default function formatInTimeZone(date, timeZone, formatStr, options) {
var extendedOptions = cloneObject(options)
var extendedOptions = cloneDeep(options || {})
extendedOptions.timeZone = timeZone
return format(utcToZonedTime(date, timeZone), formatStr, extendedOptions)
}
2 changes: 1 addition & 1 deletion src/fp/format/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../format/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var format = convertToFP(fn, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/formatInTimeZone/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../formatInTimeZone/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var formatInTimeZone = convertToFP(fn, 3)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/formatInTimeZoneWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../formatInTimeZone/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var formatInTimeZoneWithOptions = convertToFP(fn, 4)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/formatWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../format/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var formatWithOptions = convertToFP(fn, 3)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/getTimezoneOffset/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../getTimezoneOffset/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var getTimezoneOffset = convertToFP(fn, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/toDate/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../toDate/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var toDate = convertToFP(fn, 1)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/toDateWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../toDate/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var toDateWithOptions = convertToFP(fn, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/utcToZonedTime/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../utcToZonedTime/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var utcToZonedTime = convertToFP(fn, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/utcToZonedTimeWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../utcToZonedTime/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var utcToZonedTimeWithOptions = convertToFP(fn, 3)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/zonedTimeToUtc/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../zonedTimeToUtc/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var zonedTimeToUtc = convertToFP(fn, 2)

Expand Down
2 changes: 1 addition & 1 deletion src/fp/zonedTimeToUtcWithOptions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.

import fn from '../../zonedTimeToUtc/index.js'
import convertToFP from 'date-fns/fp/_lib/convertToFP/index.js'
import { convertToFP } from 'date-fns/fp/_lib/convertToFP.js'

var zonedTimeToUtcWithOptions = convertToFP(fn, 3)

Expand Down
7 changes: 2 additions & 5 deletions src/toDate/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import toInteger from 'date-fns/_lib/toInteger/index.js'
import getTimezoneOffsetInMilliseconds from 'date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js'
import { getTimezoneOffsetInMilliseconds } from 'date-fns/_lib/getTimezoneOffsetInMilliseconds.js'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried your fork on my ESM project and this import fails because it is not exported by date-fns

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: 
Package subpath './_lib/getTimezoneOffsetInMilliseconds.js' is not defined by "exports" in 
/../date-fns-tz/node_modules/date-fns/package.json 
imported from 
/../date-fns-tz/esm/toDate/index.js

I can patch date-fns to export it, but not sure what would be a better long term solution

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cellule did you find a resolution for this? I have the same error.

import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import tzPattern from '../_lib/tzPattern/index.js'

Expand Down Expand Up @@ -94,9 +93,7 @@ export default function toDate(argument, dirtyOptions) {
var options = dirtyOptions || {}

var additionalDigits =
options.additionalDigits == null
? DEFAULT_ADDITIONAL_DIGITS
: toInteger(options.additionalDigits)
options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : Number(options.additionalDigits)
if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
throw new RangeError('additionalDigits must be 0, 1 or 2')
}
Expand Down
2 changes: 1 addition & 1 deletion src/utcToZonedTime/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'power-assert'
import format from 'date-fns/format'
import { format } from 'date-fns/format.js'
import utcToZonedTime from '.'
import newDateUTC from '../_lib/newDateUTC'

Expand Down
4 changes: 2 additions & 2 deletions src/zonedTimeToUtc/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import cloneObject from 'date-fns/_lib/cloneObject/index.js'
import toDate from '../toDate/index.js'
import tzPattern from '../_lib/tzPattern/index.js'
import tzParseTimezone from '../_lib/tzParseTimezone/index.js'
import newDateUTC from '../_lib/newDateUTC/index.js'
import cloneDeep from 'lodash.clonedeep'

/**
* @name zonedTimeToUtc
Expand Down Expand Up @@ -30,7 +30,7 @@ import newDateUTC from '../_lib/newDateUTC/index.js'
*/
export default function zonedTimeToUtc(date, timeZone, options) {
if (typeof date === 'string' && !date.match(tzPattern)) {
var extendedOptions = cloneObject(options)
var extendedOptions = cloneDeep(options || {})
extendedOptions.timeZone = timeZone
return toDate(date, extendedOptions)
}
Expand Down
Loading