smithery.ai

dayjs

Day.js for date manipulation. Use when working with dates, formatting, parsing, or date calculations in CoinX.

First seen Apr 12, 2026

Installation

$ npx skills add https://smithery.ai

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,526 B
  • docs SUMMARY.md 123 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Day.js

Lightweight date library for CoinX.

Basic Usage

import dayjs from "dayjs";

// Current time
const now = dayjs();

// From date
const date = dayjs(new Date());

// From string
const parsed = dayjs("2024-01-15");
const fromFormat = dayjs("15-01-2024", "DD-MM-YYYY");

// From timestamp
const fromTs = dayjs(1705276800000);

Formatting

dayjs().format("YYYY-MM-DD"); // 2024-01-15
dayjs().format("DD MMM YYYY"); // 15 Jan 2024
dayjs().format("h:mm A"); // 2:30 PM
dayjs().format("DD MMMM YYYY"); // 15 January 2024
dayjs().format("D MMM"); // 15 Jan
dayjs().format("MMM YY"); // Jan 24

Parsing

// ISO string
dayjs("2024-01-15T14:30:00.000Z");

// Custom format
dayjs("15-01-2024", "DD-MM-YYYY");

// Multiple formats
dayjs("Jan 15, 2024", ["MMM D, YYYY", "YYYY-MM-DD"]);

Manipulation

// Add
dayjs().add(1, "day");
dayjs().add(2, "week");
dayjs().add(1, "month");
dayjs().add(1, "year");

// Subtract
dayjs().subtract(1, "day");
dayjs().subtract(30, "minute");

// Start/End of
dayjs().startOf("day"); // 00:00:00
dayjs().startOf("week"); // Start of week
dayjs().startOf("month"); // First day of month
dayjs().startOf("year"); // Jan 1

dayjs().endOf("day"); // 23:59:59
dayjs().endOf("month"); // Last day of month

Comparison

const date1 = dayjs("2024-01-15");
const date2 = dayjs("2024-01-20");

date1.isBefore(date2); // true
date1.isAfter(date2); // false
date1.isSame(date2); // false
date1.isSame(date2, "month"); // true (same month)

// Between (with plugin)
date1.isBetween("2024-01-01", "2024-01-31");

Getters

const d = dayjs("2024-01-15");

d.year(); // 2024
d.month(); // 0 (January, 0-indexed)
d.date(); // 15
d.day(); // 1 (Monday, 0 = Sunday)
d.hour(); // 0
d.minute(); // 0
d.second(); // 0

d.daysInMonth(); // 31

Relative Time (Plugin)

import relativeTime from "dayjs/plugin/relativeTime";
dayjs.extend(relativeTime);

dayjs().from(dayjs("2024-01-01")); // "14 days ago"
dayjs().fromNow(); // "a few seconds ago"
dayjs("2024-02-01").toNow(); // "in 17 days"

IsToday/IsYesterday (Plugin)

import isToday from "dayjs/plugin/isToday";
import isYesterday from "dayjs/plugin/isYesterday";
import isTomorrow from "dayjs/plugin/isTomorrow";

dayjs.extend(isToday);
dayjs.extend(isYesterday);
dayjs.extend(isTomorrow);

dayjs().isToday(); // true
dayjs().subtract(1, "day").isYesterday(); // true
dayjs().add(1, "day").isTomorrow(); // true

Localization

import "dayjs/locale/de";

dayjs.locale("de");
dayjs().format("MMMM"); // "Januar"

// Per-instance
dayjs().locale("fr").format("MMMM");

CoinX Pattern

// Transaction date display
const formatTransactionDate = (date: string) => {
  const d = dayjs(date, "DD-MM-YYYY");

  if (d.isToday()) return "Today";
  if (d.isYesterday()) return "Yesterday";
  if (d.isTomorrow()) return "Tomorrow";

  return d.format("DD MMMM YYYY");
};

// Duration range
const getDateRange = (type: "week" | "month" | "year") => ({
  startTime: dayjs().startOf(type).format(),
  endTime: dayjs().endOf(type).format(),
});

ISO Strings for DB

// Store as ISO string
const isoString = dayjs().toISOString();
// "2024-01-15T14:30:00.000Z"

// Read from ISO
const date = dayjs(isoString);