ndom91 / react-timezone-select

🌐 An extremely usable and dynamic React timezone selector
https://ndom91.github.io/react-timezone-select/
MIT License
218 stars 47 forks source link

Module not found: Error: Package path . is not exported in react-timezone-select #133

Open alex-ohadi opened 1 month ago

alex-ohadi commented 1 month ago

Describe the bug

Latest version that works react-timezone-select@2.1.5 works Breaking change starts here: react-timezone-select@3.2.0

Current Webpack version installed "webpack": "^5.95.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.1.0", "webpack-shell-plugin-next": "^2.3.2"

Error message:

Module not found: Error: Package path . is not exported from package in /node_modules/react-timezone-select

Reproduction

yarn start

System Info

Current Webpack version installed
    "webpack": "^5.95.0",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^5.1.0",
    "webpack-shell-plugin-next": "^2.3.2"

Used Package Manager

yarn

Validations

alex-ohadi commented 1 month ago

I noticed that in the newer version

"exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" } },

./dist/index.cjs was removed

zthomas1 commented 1 month ago

any workaround, for a really simple use case this has been a dead end.

@ndom91

zthomas1 commented 1 month ago

@alex-ohadi did you find another options?

alex-ohadi commented 1 month ago

Yup, I just removed this feature entirely and got the timezone based on the browser. Alex OhadiOn Oct 30, 2024, at 7:19 AM, zthomas1 @.***> wrote: any workaround, for a really simple use case this has been a dead end.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

alex-ohadi commented 1 month ago
const [timezone] = useState( Intl.DateTimeFormat().resolvedOptions().timeZone)

You can get various abbreviations and offsets by tweaking this output const abbrev = new Intl.DateTimeFormat('en-US', options).formatToParts(date); const date = new Date(); const offset = date.getTimezoneOffset();