.tz is not a function
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Trying to use the timezone plugin but getting .tz() is not a function error.
**Information**
- 1.9.8
- React Native (Android)
- America/Vancouver
**Setup**
```
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';
dayjs.extend(utc);
dayjs.extend(timezone);
console.log(dayjs().tz('America/Vancouver'))
```
**Error**
```
[Wed Feb 10 2021 09:51:03.304] ERROR TypeError: (0, _dayjs.default)().tz is not a function. (In '(0, _dayjs.default)().tz('America/Vancouver')', '(0, _dayjs.default)().tz' is undefined)
```
Contributor guide
Research direction
Start by reproducing the reported React Native Android setup with dayjs/plugin/utc and dayjs/plugin/timezone, using version 1.9.8 and America/Vancouver. Check why the resulting dayjs instance lacks .tz(); done means the shown call works without the TypeError and the relevant regression is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100