Bun Dates and Times
Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions
Install
npx skills add jarle/bun-skills --skill Bun Dates and timesgit 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-timesPersonal 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`:Details
- Skill name
Bun Dates and times- Repository
- jarle/bun-skills
- 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
Bun Archive
9jarle/bun-skills
Create and extract tar archives with Bun's fast native implementation
Bun Auto Install
9jarle/bun-skills
Bun's automatic package installation feature for standalone script execution
Bun Bun Add
9jarle/bun-skills
Add packages to your project with Bun's fast package manager
Bun DOM Testing
9jarle/bun-skills
Learn how to test DOM elements and components using Bun with happy-dom and React Testing Library
Auditing Repositories
5tomada1114/tomada-claude-plugins
Audit the repository you are in, often a template or an app cut from one, for technical debt and room to improve in four areas: architecture and design patterns; tests; file structure and code quality; and tooling, CI, dependencies and the agent harness. Design a safe, test-first fix for every evidenced finding, and file the findings as GitHub issues that follow the repository's own issue conventions (triaging-issues, issue forms, past issues). A finding inherited from the template is also filed in the template repository. Cheap read-only sub-agents collect the evidence and high-effort analyst
Bun Finding Tests
9jarle/bun-skills
Learn how Bun's test runner discovers and filters test files in your project
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.