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
Property 'tz' does not exist on type 'Moment' Error #906
Comments
I'm having exactly the same issue. node version: Usages:
They yield same result:
|
Any update regarding this ? |
I resolved this by downgrading the I found that the offending lines in
|
Using the latest version at this time of writing:
So I think this is issue is resolved. |
No issues after installing @types/moment-timezone@0.5.30 |
I'm closing this since the issue is resolved. |
i sove this problem
2.import time-zone in app.component.ts file 3.save and run -check some moment-timezone package version not work |
This issue re-occured again with the following versions: "moment": "2.29.3",
"moment-timezone": "0.5.34" Downgrading moment to 2.29.2 fixes the issue. Edit: import moment from 'moment-timezone';
// use moment as you would if you had imported 'moment';
` |
I was having this problem in just my test environment. I had to add TSConfig and Types array documentation: Refactoring the app to use moment-timezone rather than moment also fixed the problem, but I decided that the tsconfig solution was simpler and less risky. |
In my case, had to downgrade to 2.29.1 (2.29.2 still failed to build), resulting in
my failing usecase: import moment, { Moment } from "moment";
import "moment-timezone";
const func1 = (day: Moment, seconds: number, timeZone: string): Moment =>
day.clone().add(seconds, "seconds").tz(timeZone, true).local(); |
The same issue with versions:
Downgraded to 2.29.1, but it contains vulnerabilities. |
I'm having the same issue. moment version: 2.24.3 When I wrote the next code, the issue is gone:
|
This is generally caused by having multiple versions of As noted by @DiRover, importing from only |
Solved by @gilmoreorless comments. Changed my import to |
import 'moment-timezone'; //then--------- var currentTimEzone = moment.tz.guess(); |
nodejs version:
12.18.4
moment-timezone version:
0.5.31
moment version:
^2.29.0
ts-node version: happens both in 9.0.0(latest),
8.6.2
command:
ts-node --files server/app.ts --project server/tsconfig.build.json
usage
No
@types/moment or @types/moment-timezone
installed since deprecated.What could be the reason ?
PS: Already checked this Issue
The text was updated successfully, but these errors were encountered: