Your vite branch now has a package.json, so the store’s site is an npm project. The README’s first to-do, the “Open now” badge, is where that starts to pay off. When the store is closed, the badge has to say when it opens next. On Christmas Eve evening, that means skipping Christmas Day and landing on Saturday morning. Adding days and comparing them is where JavaScript’s built-in Date gets clumsy, so the badge gets a small date library, dayjs.
In this lesson, you’ll check dayjs before you install it, install it with npm, and read what the install changed in your project, so you know which files to commit and which to leave out. Start with the check, because it’s the one step that npm can’t do for you.
Check dayjs Before You Install It
npm install downloads code that someone else wrote and puts it into your project, where your site will run it. Anyone with a free account can publish a package to the npm registry, so a package’s name alone doesn’t tell you whether you can trust it.
A quick look before you install takes a minute or two, and it answers four questions:
-
The name: Is it exactly the package you mean? The library calls itself Day.js, but its package is
dayjs, and a name that’s one character off can belong to someone else entirely. -
Weekly downloads: Is it widely used? The number counts every download, including the ones from automated builds and registry copies called mirrors, so it’s only a rough sign of how many projects use the package. If a library you expected to be popular shows only a handful of downloads, then you may be looking at the wrong name.
-
Repository: Where does its source code live? The link takes you to the code and shows who maintains it.
-
Last publish: Is someone still working on it? A release from years ago isn’t necessarily a problem for a small library, but it’s worth a second look.
Open the package’s page, www.npmjs.com/package/dayjs, in your browser. The sidebar next to the package’s README shows the Repository, the Weekly Downloads, and the Last publish date. For dayjs, the downloads run into the millions every week, and the repository is iamkun/dayjs on GitHub.
You can check part of this without leaving the terminal. npm view prints some of what the registry knows about a package, without installing anything:
$ npm view dayjs
[email protected] | MIT | deps: none | versions: 136
2KB immutable date time library alternative to Moment.js with the same modern API
https://day.js.org
keywords: dayjs, date, time, immutable, moment
dist
.tarball: https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz
.shasum: b0a363506dde5f36cf5075e42ebe8115165a8c79
.integrity: sha512-QDTCU0M0MxR3hQfnlDJf...
.unpackedSize: 681.7 kB
maintainers:
- iamkun <[email protected]>
dist-tags:
latest: 1.11.23
alpha: 2.0.0-alpha.4
published 3 months ago by GitHub Actions <[email protected]>
The first line confirms the name and the newest version, 1.11.23. The part that says deps: none means that dayjs doesn’t bring any other packages along, so it’s the only new code that lands in your project. The last line shows when the package was last published. If dayjs has had a release since this lesson was written, then your version and date will be newer, and that’s fine.
The output doesn’t show the weekly downloads, so you’ll need to check that number on the package’s page. It doesn’t show the repository either, but you can ask for that one field by name:
$ npm view dayjs repository.url
git+https://github.com/iamkun/dayjs.git
That’s the same iamkun/dayjs repository that the package’s page links to.
The same check applies when a package comes from an AI coding assistant. These models sometimes suggest packages that don’t exist, and researchers have measured how often. In a 2025 study, at least 5.2 percent of the packages that commercial models suggested weren’t real. An attacker can register such a name and wait for someone to install it, so an AI’s suggestion gets the same four checks before you type npm install.
If an assistant has ever suggested a package to you, then the button below opens a chat with the mentor, so you can go through the checks together: