BASE

Day.js

Day.js

Web framework / library · Free

A small date library with an immutable API and plugins: it helps format and convert dates in interfaces and Node.js.

Also known as: iamkun/dayjs; dayjs; day.js; day-js

Resource illustration: Day.js

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Convert dates through an immutable API
  • Connect formatting/conversion to application date display

Example workflow

A possible workflow; this is not a report of hands-on testing.

Convert dates through an immutable API.

Before you start

  • Web application source code and the intended workflow.
  • The project's framework and runtime version.

Steps

  1. Choose date operations and required plugins.
  2. Connect formatting/conversion to application date display.
  3. Add real data and error handling; check the production build.

Check your result

  • The workflow works after a page refresh and with invalid data.
  • The bundle, server rendering, and supported browsers suit the project.

Choosing Day.js

Convert dates through an immutable API

Choose this when

  • Convert dates through an immutable API
  • Connect formatting/conversion to application date display

Requirements

  • An additional feature requires its corresponding plugin; localized output requires the chosen locale.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for the code; dependencies have separate licenses.

Frequently asked questions

What can you use for free in Day.js?

Code and local use under MIT.

What additional costs might arise with Day.js?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for Day.js?

MIT for the code; dependencies have separate licenses.

How do you get started with Day.js?

Choose date operations and required plugins. Connect formatting/conversion to application date display. Add real data and error handling; check the production build.

Why aren't AdvancedFormat or the required locale available immediately?

Day.js keeps a small core API and connects extensions separately. For example, import advancedFormat and register it through extend; locales also load as needed. Objects are immutable, and methods support chaining. Similarity to Moment.js should not be read as a promise that every API matches completely.

License

MIT for the code; dependencies have separate licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • Day.js
  • web
  • Development

Sources

Other resources