react-datetime
react-datetime copied to clipboard
moment.tz is not a function | moment-timezone is installed as a dependency
As per docs I have installed moment-timezone in my project but still getting moment.tz is not a function
. Error occurring when I am using the prop displayTimeZone
.
Project Tech: React.JS | ROR | Webpacker
Are you sure you are importing at least once from moment-timezone
. Here's an example on how use it
https://codesandbox.io/s/happy-snowflake-gbo1b?file=/src/App.js:0-272
import * as React from "react";
import "react-datetime/css/react-datetime.css";
import Datetime from "react-datetime";
import moment from "moment-timezone";
export default function App() {
return <Datetime displayTimeZone="America/Los_Angeles" value={new Date()} />;
}
Could it be the bundler @arqex? I tried the same order as the example but it didn't work
Hi @arqex @arqex @arqex @arqex
i have also tried this but not working for me as well,
i'm using Storybook for demo my standalone component with some customization but displayTimeZone
is not working.
any quick response would be appreciated .
I was having TypeError: a.a.tz is not a function
error as well. Deleting and reinstalling dependencies solved it