Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marnusw committed Jan 30, 2023
1 parent 7b83b92 commit 4a2db96
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
### v2.0.0 (30 January 2023)

- [BREAKING CHANGE] Optimize configuration for ESM exports (entry points for cjs / esm / typescript) (#212)

**Upgrade guide:** Both CJS and ESM imports now use the default import paths. CJS will continue working unchanged;
to fix EMS imports:

Before:

```js
import { format } from 'date-fns-tz/esm'
import utcToZonedTime from 'date-fns-tz/esm/utcToZonedTime'
```

After:

```js
import { format } from 'date-fns-tz'
import utcToZonedTime from 'date-fns-tz/utcToZonedTime'
```

### v1.3.8 (30 January 2023)

- [TESTS] Tests documenting `zonedTimeToUtc` daylight saving jumps (#220)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ If you find this library useful, why not

## ESM and CommonJS

As of `v1.3.0` this library supports native ESM imports in Node.js. Since exports field in [package.json](./package.json)
defines the correct entry point depending on project type (`commonjs` vs. `ESM`) the import path does not change.
Make sure to set the `type` property in your project's `package.json` to either `module`, for ESM, or `commonjs` and
This library supports CommonJS and native ESM imports. The exports field in [package.json](./package.json)
defines the correct entry point depending on project type, so the same import path is used for both.
Make sure to set the `type` property in your project's `package.json` to either `module`, for ESM, or `commonjs`.

Even when using ESM some CommonJS imports from `date-fns` will be used until they support
ESM natively as well [date-fns#1781](https://github.com/date-fns/date-fns/issues/1781).
This is because an ESM projects cannot use ESM imports from a library that doesn't specify
This is because an ESM project cannot use ESM imports from a library that doesn't specify
`{"type": "module"}`.

## Table of Contents
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "date-fns-tz",
"version": "1.3.8",
"version": "2.0.0",
"sideEffects": false,
"description": "Time zone support for date-fns v2 with the Intl API",
"author": "Marnus Weststrate <[email protected]>",
Expand Down

0 comments on commit 4a2db96

Please sign in to comment.