1K Date Formatting

🌐Community
by onekeyhq · vlatest · Repository

Automatically formats dates across various sources into a consistent, unified format for seamless data integration.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add 1k-date-formatting npx -- -y @trustedskills/1k-date-formatting
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "1k-date-formatting": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/1k-date-formatting"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill, "1K Date Formatting," provides a consistent and unified way to format dates and times within OneKey applications. It prevents the use of native JavaScript date methods by leveraging utilities from @onekeyhq/shared/src/utils/dateUtils for accurate and standardized formatting. The skill offers various functions including full date/time, time-only, relative display (e.g., "Today," "Yesterday"), distance to now (e.g., "2 hours ago"), and custom format options using date-fns templates.

When to use it

  • Displaying transaction history with consistent date formatting.
  • Creating user interfaces where dates need to be presented in a unified style.
  • Generating reports or data exports requiring standardized date formats.
  • Dynamically updating date displays within React components using the provided useFormatDate hook.
  • When needing to hide specific parts of a date (year, month, time, seconds) for clarity and brevity.

Key capabilities

  • formatDate(date, options?): Formats dates with various options like hiding year/month or specifying custom formats.
  • formatTime(date, options?): Formats only the time portion of a date.
  • formatRelativeDate(date): Displays dates in relative terms (Today, Yesterday).
  • formatDistanceToNow(date): Shows the time elapsed since a given date.
  • formatDateFns(date, format?): Allows for custom formatting using date-fns templates.
  • React hook useFormatDate(): Provides dynamic date formatting updates within React components.
  • Options to hide year, month, time, and seconds.

Example prompts

  • "Format this date as yyyy-LL-dd HH:mm: 2024-01-15T14:30:00Z"
  • "Show me the relative date for January 1st, 2024."
  • "What is the time only format of this date? 2024-01-15T14:30:00Z"

Tips & gotchas

  • Important: This skill requires using the @onekeyhq/shared/src/utils/dateUtils library and its functions. Avoid using native JavaScript date methods like toLocaleDateString() or toISOString().
  • Refer to the detailed guide (date-formatting.md) for comprehensive formatting rules, options reference, and troubleshooting tips.
  • The React hook useFormatDate simplifies dynamic date updates within React components.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
onekeyhq
Installs
46

🌐 Community

Passed automated security scans.