Skip to content
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

Cannot read property 'relativeTime' of undefined #501

Closed
Newbie012 opened this issue Feb 19, 2019 · 4 comments
Closed

Cannot read property 'relativeTime' of undefined #501

Newbie012 opened this issue Feb 19, 2019 · 4 comments
Labels
☢️Bug Something isn't working released

Comments

@Newbie012
Copy link

Getting the following error:

Uncaught TypeError: Cannot read property 'relativeTime' of undefined
    at fromTo (index.js:21)
    at Dayjs.push../node_modules/dayjs/esm/plugin/relativeTime/index.js.__webpack_exports__.default.proto.from (index.js:89)
    at Module../src/app/core/utils/dayjs.ts (dayjs.ts:9)

While trying to run the code:

import _dayjs from 'dayjs/esm';
import relativeTime from 'dayjs/esm/plugin/relativeTime';
import 'dayjs/locale/en';
import 'dayjs/locale/he';

_dayjs.locale('he');
_dayjs.extend(relativeTime);

console.log(_dayjs().from(_dayjs('1990'))); // <-- Fails

Running "dayjs": "^1.8.6"

@iamkun iamkun added the ☢️Bug Something isn't working label Feb 19, 2019
@iamkun
Copy link
Owner

iamkun commented Feb 19, 2019

This is a bug.

Current workaround

import he from  'dayjs/locale/he';
_dayjs.locale(he);   // register manually

_dayjs.locale('he');   // use in other place

@iamkun iamkun closed this as completed in 9815467 Feb 23, 2019
@iamkun
Copy link
Owner

iamkun commented Feb 24, 2019

🎉 This issue has been resolved in version 1.8.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bdoycn
Copy link

bdoycn commented Oct 22, 2019

v1.8.16 也出现了此问题, 使用上面的方案也可解决
使用的语言是 zh-cn

@iamkun
Copy link
Owner

iamkun commented Oct 22, 2019

@bdoycn 这是一个 1.8.8 版本就 fix 了的bug 如果1.8.16 还有问题 请详细描述一下,谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️Bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

3 participants