# date-and-time

> The simplest, most intuitive date and time library

Latest version **4.6.0** (published 2026-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install date-and-time
pnpm add date-and-time
yarn add date-and-time
bun add date-and-time
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.6.0 |
| Published | 2026-09-22 |
| First published | 2015-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 511.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 187 |
| Author | KNOWLEDGECODE |
| Maintainers | knowledgecode |
| Keywords | date, datetime, duration, format, parse, time, timezone |

## Links

- npm: https://www.npmjs.com/package/date-and-time
- Repository: https://github.com/knowledgecode/date-and-time
- Homepage: https://knowledgecode.github.io/date-and-time/
- Issues: https://github.com/knowledgecode/date-and-time/issues
- npm.io page: https://npm.io/package/date-and-time

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 4.6.0 (latest) — 2026-09-22
- 4.5.2 — 2026-08-30
- 4.5.1 — 2026-06-27
- 4.5.0 — 2026-05-06
- 4.4.0 — 2026-03-29
- 4.3.1 — 2026-03-07
- 4.3.0 — 2026-02-23
- 4.2.0 — 2026-01-18
- 4.1.2 — 2025-12-14
- 4.1.1 — 2025-11-17
- 4.1.0 — 2025-10-08
- 4.0.5 — 2025-09-12
- 4.0.4 — 2025-09-01
- 4.0.3 — 2025-08-28
- 4.0.2 — 2025-08-13
- … 61 more at https://npm.io/package/date-and-time/versions

## README

# date-and-time

<div align="center">
  <img src="https://raw.githubusercontent.com/knowledgecode/date-and-time/refs/heads/master/logo.png" alt="date-and-time" width="256">
</div>

<div align="center">

[![CI](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml/badge.svg)](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
[![Coverage](https://codecov.io/gh/knowledgecode/date-and-time/graph/badge.svg)](https://codecov.io/gh/knowledgecode/date-and-time)
[![npm](https://img.shields.io/npm/v/date-and-time)](https://www.npmjs.com/package/date-and-time)

</div>

The simplest, most intuitive date and time library.

## Installation

```shell
npm install date-and-time
```

### ES Modules (Recommended)

```typescript
import { format } from 'date-and-time';

format(new Date(), 'ddd, MMM DD YYYY');
// => Wed, Jul 09 2025
```

### CommonJS

```typescript
const { format } = require('date-and-time');

format(new Date(), 'ddd, MMM DD YYYY');
// => Wed, Jul 09 2025
```

## CDN Usage

### Via jsDelivr

```html
<script type="module">
  import { format } from 'https://cdn.jsdelivr.net/npm/date-and-time/dist/index.js';

  console.log(format(new Date(), 'YYYY/MM/DD'));
</script>
```

### Via unpkg

```html
<script type="module">
  import { format } from 'https://unpkg.com/date-and-time/dist/index.js';

  console.log(format(new Date(), 'YYYY/MM/DD'));
</script>
```

## Migration

Version `4.x` has been completely rewritten in TypeScript and some features from `3.x` are no longer compatible. The main changes are as follows:

- The `timezone` and `timespan` plugins have been integrated into the main library
- Tree shaking is now supported
- Supports `ES2021` and no longer supports older browsers

For details, please refer to [migration.md](https://github.com/knowledgecode/date-and-time/blob/master/docs/migration.md). If you use an AI coding agent, the `date-and-time-migration` skill can carry out the migration; see [Agent Skills](#agent-skills).

## API

For comprehensive documentation and examples, visit: **[GitHub Pages](https://knowledgecode.github.io/date-and-time/)**

## Agent Skills

This repository ships two [Agent Skills](https://agentskills.io) that help AI coding agents (Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and others) work with this library:

| Skill | Use it to |
|-------|-----------|
| [`date-and-time`](https://github.com/knowledgecode/date-and-time/tree/master/skills/date-and-time) | Write code with date-and-time v4: formatting, parsing, timezones, locales, plugins, date arithmetic, durations |
| [`date-and-time-migration`](https://github.com/knowledgecode/date-and-time/tree/master/skills/date-and-time-migration) | Migrate a project from date-and-time v3 to v4 |

Each skill is self-contained, so you can install either one on its own. The skills are not part of the npm package.

### Install

With the [`skills`](https://github.com/vercel-labs/skills) CLI:

```shell
# Both skills, into the current project
npx skills add knowledgecode/date-and-time --skill date-and-time --skill date-and-time-migration

# One skill, globally, for a specific agent (Claude Code here)
npx skills add knowledgecode/date-and-time --skill date-and-time -g -a claude-code

# See what the repository offers before installing
npx skills add knowledgecode/date-and-time --list
```

Or copy a skill directory by hand into your agent's skills directory (`.claude/skills/` for Claude Code, `.agents/skills/` for agents that follow the shared convention):

```shell
git clone --depth 1 https://github.com/knowledgecode/date-and-time.git
mkdir -p .claude/skills
cp -R date-and-time/skills/date-and-time .claude/skills/
```

## License

MIT

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

---
_Source: https://npm.io/package/date-and-time · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
