stacks-datetime

Provides a DateTime class and format/parse utilities for Stacks applications.

622|17|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/stacksjs/stacks --skill stacks-datetime
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-datetime
Source: https://github.com/stacksjs/stacks/tree/main/.claude/skills/stacks-datetime
Command: npx skills add https://github.com/stacksjs/stacks --skill stacks-datetime

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Stacks date/time handling is centralized to reduce boilerplate and errors when working with dates, times, timezones, and formatted strings across apps.

Core Features & Use Cases

  • Immutable DateTime class with add/subtract operations and arithmetic
  • Standalone format() and parse() utilities with token-based tokens
  • Timezone and locale support, with robust formatting and parsing
  • Use cases across APIs, CLIs, and apps for consistent date handling

Quick Start

Instantiate a DateTime and format it using the format() utility.

Frequently Asked Questions about stacks-datetime

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I format dates and times consistently across server and client code?

Date and time parsing handles immutability through a dedicated DateTime class where operations like add and subtract return new instances rather than modifying the original object. This immutable approach prevents unintended side effects during date arithmetic across your application.

Does this datetime utility support timezone and locale handling via Intl?

Token-based date formatting uses specific tokens to represent date and time elements, allowing customizable output strings. By applying standalone format utilities with these tokens, you achieve precise control over how dates are rendered across APIs, CLIs, and app interfaces.

What is the best way to handle date arithmetic without causing mutation bugs?

The best way to handle date arithmetic without causing mutation bugs is using an immutable DateTime class that returns new instances for add and subtract operations. This approach eliminates boilerplate and errors common in mutable date manipulation.

Can I use standalone format and parse utilities without instantiating the full DateTime class?

Yes, you can use standalone format and parse utilities independently for token-based formatting and parsing. These utilities provide flexible date handling without requiring full DateTime class instantiation, enabling consistent output across various application contexts.