Skip to content
Agents tracked: 440 Downloads (7d): 202M down 19.5% GitHub stars: 10.4M Releases (7d): 607 Agent status: 1 with issuesSince last limit reset: Claude 28d · Codex 0d Updated Oct 21, 2026

date-fns Examples You Can Edit and Run

5 small date-fns examples written by AgentGid from the official docs, one feature each. Every one runs in your browser: change the code and see the result at once, or describe a change and let AI rewrite it. The screenshots are taken from the same code by our server, which also checks that each example starts without errors.

date-fns: usage and stats 647 AI-built projects use it

Try them all in one place

import { compareAsc, format } from "date-fns";

const tasks = [
  { name: "Write report", due: new Date(2024, 5, 14) },
  { name: "Book flights", due: new Date(2024, 4, 2) },
  { name: "Renew passport", due: new Date(2024, 3, 28) },
  { name: "Team review", due: new Date(2024, 5, 3) },
];

const byDue = [...tasks].sort((a, b) => compareAsc(a.due, b.due));

console.log("Tasks by due date:");
for (const t of byDue) {
  console.log(`  ${format(t.due, "yyyy-MM-dd")}  ${t.name}`);
}
Ctrl/⌘ + Enter runs

Free for signed-in members, with a daily limit. Describe the change in plain words; the new code runs only in your browser.

Rename the due field or add tasks to try it with your own data. Code written by AgentGid [1]. How it works, with a screenshot →

Checked Oct 14, 2026: each example starts without errors in Chromium with date-fns 4.4.0. Needs WebGL.

Sources

  1. date-fns README (GitHub)

Explanations written by AgentGid from the official docs; the numbers in brackets point here. The code marked "written by AgentGid" is ours and free to copy.

Building something with date-fns? Ask AgentGid →