iamkun / iamkun/dayjs

How do we install day.js plugins to a browser?

Open
#2,883 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I'm sorry if this is a silly question, but I cannot find how to successfully install / import / require plugins into a browser environment.

ie. On an HTML page / site, sourcing the day.js file either via CDN or local file, and then doing the same for the plugins.

This is the day.js browser install page.

https://day.js.org/docs/en/installation/browser

Then the plugin install page is this:

https://day.js.org/docs/en/plugin/loading-into-browser

However, none of the listed plugins have any information about what JS files to look for, or the path to the CDN, or even being able to download the plugin files. I managed to find the plugin file repository and downloaded one I was interested in, customParseFormat. I downloaded the minified code and sourced it.

But I just get an error at this command.

```
dayjs.extend(customParseFormat);

Uncaught ReferenceError: customParseFormat is not defined

```
I expect that for people very used to GitHub, or the ins and outs of JavaScript etc, that how to get this to work is well known. But its not at all obvious what to do.

It would be really helpful to have links from the plugins to their repositories. And if there are some other instructions about how to source and use the plugins, that would be really appreciated.

Cheers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.