dayjs / dayjs-website

⏰Day.js website repo
http://day.js.org/
MIT License
65 stars 228 forks source link

Add ES2015 snippets for timezone plugin use #49

Closed ardunster closed 3 years ago

ardunster commented 3 years ago

I couldn't find anywhere in the documentation that actually gave me the correct syntax to import and use these plugins in my Typescript project (import 'dayjs/plugin/utc' didn't result in a variable to feed to .extend, and when I tried import { utc } from 'dayjs/plugin/utc' it couldn't find an object to import), so I tried this and it seems to work fine, suggest adding for users who are not using the require syntax.

iamkun commented 3 years ago

I'll close this pr, and will update the correct usage later.

Besides, you can refer to this https://day.js.org/docs/en/installation/typescript#locale-and-plugin-import

ardunster commented 3 years ago

It would be great if that information was also included in the plugin section, I had already successfully installed and used dayjs all over my project in typescript and it did not occur to me that the plugin instructions would be in the typescript installation section.

Also, your response makes it sound like the notes I added are not the correct usage. If that's so, how is it incorrect? It looks the same as the information you linked and it works.

iamkun commented 3 years ago

Check this https://day.js.org/docs/en/installation/typescript#have-trouble-importing-dayjs

might relate to yur ts config