Bun Dates and Times

Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions

9 stars 1 forksTesting & QA

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add jarle/bun-skills --skill Bun Dates and times
Manual install
git clone --depth 1 https://github.com/jarle/bun-skills.git /tmp/bun-skills
mkdir -p ~/.claude/skills
cp -r /tmp/bun-skills/skills/bun-test-dates-times ~/.claude/skills/Bun-Dates-and-times

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Dates and times

> Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions

`bun:test` lets you change what time it is in your tests.

This works with any of the following:

* `Date.now`
* `new Date()`
* `new Intl.DateTimeFormat().format()`

<Note>Timers are not impacted yet, but may be in a future release of Bun.</Note>

## setSystemTime

To change the system time, use `setSystemTime`:

```ts title="test.ts" icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
import { setSystemTime, beforeAll, test, expect } from "bun:test";

beforeAll(() => {
  setSystemTime(new Date("2020-01-01T00:00:00.000Z"));
});

test("it is 2020", () => {
  expect(new Date().getFullYear()).toBe(2020);
});
```

To support existing tests that use Jest's `useFakeTimers` and `useRealTimers`, you can use `useFakeTimers` and `useRealTimers`:
Read the full skill on GitHub

Details

Skill name
Bun Dates and times
Path
skills/bun-test-dates-times/SKILL.md
License
MIT
Repo updated
24 February 2026

FAQ

What does the Bun Dates and Times skill do?

Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions

How do I install the Bun Dates and Times skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add jarle/bun-skills --skill Bun Dates and times. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Bun Dates and Times popular?

It lives in jarle/bun-skills, which has 9 GitHub stars and 1 forks.

Related skills

Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.