timezone

SKILL开发
开发 未标注权限 许可证不明确

REQUIRED for ANY date/time code - prevents timezone bugs by enforcing Mountain Time utilities instead of native Date objects. Use when working with dates, times, timestamps, scheduling, cutoffs, date inputs, or API date serialization.

一句话选型结论

按资料字段整理

timezone是开发类的 Agent Skill,安装方式:GitHub 仓库,权限级别未标注,许可证不明确,没有现成安装命令,需按说明手动放置 SKILL.md。技能本质是给模型读的说明书,效果取决于模型与客户端;装完先用一个小任务验证,再放进正式流程。

分类开发 安装方式GitHub 仓库 权限级别未标注权限 许可证许可证不明确
累计安装 未标注 本周 未标注
GitHub 星标 1 仓库 sweet-angel-bakery
下载量 未标注 技能市场下载数
权限级别 未标注权限 安装前请确认风险范围
许可证 许可证不明确 未说明

安装

GitHub 仓库
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
  1. 1
    确认客户端支持

    确认你的客户端支持 Skills(Claude、Codex、Cursor 等),并升级到较新的版本。

  2. 2
    拿到技能文件

    按安装说明或仓库 README,把 SKILL.md 放到客户端的 skills 目录(一般一个技能一个文件夹)。

  3. 3
    刷新技能列表

    重新打开客户端,或刷新技能列表,让新放进来的技能被加载。

  4. 4
    验证是否生效

    问一句「你有哪些技能」,确认列表里出现它,再拿一个小任务试跑。

技能档案

开发
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方zacjones93仓库 sweet-angel-bakery · 版本 未标注
宿主客户端未标注技能可被这些客户端加载
安装方式GitHub 仓库安装包 zacjones93/sweet-angel-bakery
权限级别未标注权限安装前请确认风险范围
许可证未说明许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验未标注上游最后核验时间 · 数据更新 未标注
正文体量12.5 KBSKILL.md 原文大小,越大说明说明书写得越细

典型使用场景

3 类
按分类整理的常见用法,具体以 SKILL.md 为准
写代码与改 bug

按需求补代码、定位并修掉报错。

读仓库与生成改动

让模型读懂项目结构,再给出可落地的改动。

跑测试与排查故障

按现象排查问题,补测试用例并复跑。

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 基础信息齐全,可以先按说明装一个试试。

先想清楚的地方

  • 没有标注权限级别,实际能做什么要装好后确认。
  • 许可证不明确,商用或二次分发前先到仓库确认条款。
  • 没有现成安装命令,要按安装说明或仓库 README 手动放置。
  • 没有做站内核验,内容以作者仓库为准。
  • 技能只是说明书,实际效果取决于模型与客户端,装完先用小任务试一遍。

更适合

  • 需要在开发场景里给模型补一套做法的人。
  • 愿意先读一遍 SKILL.md、确认它会让模型做什么的人。

不太适合

  • 对许可证要求很严、必须明确可商用的人。
  • 只想装完就自动变强、不打算看说明书的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
技能权限级别安装方式累计安装宿主客户端安装命令
timezone当前 未标注权限 GitHub 仓库 未标注 未标注 无
技能审查员 浏览器控制 ClawHub 市场 877.9 万 OpenClaw 有
Vercel React 最佳实践 浏览器控制 GitHub 仓库 849.1 万 Codex、Claude、Cursor 有
GitHub 代码协作 联网访问 ClawHub 市场 763.3 万 OpenClaw 有
网页设计指南 联网访问 GitHub 仓库 668.6 万 Codex、Claude、Cursor 有
本体论 只读 ClawHub 市场 663.7 万 OpenClaw 有

SKILL.md 全文

12.5 KB
模型实际读到的说明书原文,来自技能仓库

Mountain Time & Date Handling Skill

Purpose

Ensure all date/time operations in Sweet Angel Bakery use Mountain Time (America/Boise) consistently to prevent timezone bugs, off-by-one errors, and scheduling issues. The business operates in Mountain Time, and all features must respect this regardless of user location or server environment (Cloudflare Workers run in UTC).

When to Activate This Skill

REQUIRED whenever working with:
- Date/time comparisons or calculations
- Delivery/pickup scheduling
- Active/scheduled content (banners, notifications, product drops)
- Cutoff time validation
- API serialization of dates
- HTML date inputs
- Countdown timers
- Calendar or scheduling features
- Database queries filtering by timestamps
- Any code calling new Date() or parsing date strings

Core Principles

  1. Never use new Date() for business logic - always use getCurrentMountainTime()
  2. Never parse ISO dates without timezone context - use parseMountainISODate()
  3. Never serialize dates with .toISOString().split('T')[0] - use getMountainISODate()
  4. Always store timestamps in UTC - use integer({ mode: "timestamp" }) in schema
  5. Always validate date inputs - use Zod schemas from @/schemas/date.schema.ts
  6. Always label timezone in admin UI - add "(Mountain Time)" or "(MT)" to labels

Database Storage Pattern

✅ CORRECT: Store UTC, Compare in MT

// Schema - store as UTC timestamp
export const contentTable = sqliteTable("content", {
  startDate: integer({ mode: "timestamp" }), // UTC timestamp
  endDate: integer({ mode: "timestamp" }),   // UTC timestamp
});

// Server action - compare in Mountain Time
import { getCurrentMountainTime } from "@/utils/timezone";

const now = getCurrentMountainTime(); // Current MT time as Date object
const active = await db.select()
  .from(contentTable)
  .where(
    and(
      lte(contentTable.startDate, now), // Compares UTC timestamps correctly
      gte(contentTable.endDate, now)
    )
  );

Why this works:
- Database stores absolute UTC timestamps (portable, no DST issues)
- getCurrentMountainTime() returns Date object representing "now" in MT
- JavaScript Date objects internally use UTC timestamps
- Drizzle ORM compares the underlying UTC values correctly

Critical Patterns

✅ Server-Side Date Operations

"use server";

import { getCurrentMountainTime, getMountainISODate } from "@/utils/timezone";

/**
 * TIMEZONE: Uses Mountain Time for all date comparisons.
 * Scheduled content activates based on MT time, regardless of user location.
 */
export const myAction = createServerAction()
  .handler(async () => {
    const now = getCurrentMountainTime();

    // For API responses, serialize as ISO string in MT
    return {
      date: getMountainISODate(now), // "YYYY-MM-DD" in MT
      items: activeItems.map(item => ({
        ...item,
        deliveryDate: getMountainISODate(item.deliveryDate),
      })),
    };
  });

✅ HTML Date Inputs

"use client";

import { getMountainISODate } from "@/utils/timezone";

<div className="space-y-2">
  <Label htmlFor="date">Delivery Date (Mountain Time)</Label>
  <Input
    id="date"
    type="date"
    min={getMountainISODate(new Date())}
    value={selectedDate}
    onChange={(e) => setSelectedDate(e.target.value)}
  />
  <p className="text-xs text-muted-foreground">
    Available dates are in Mountain Time
  </p>
</div>

✅ Client-Side Date Display

"use client";

/**
 * Parse ISO date string for display only.
 * Creates Date in browser timezone - acceptable for display purposes.
 *
 * IMPORTANT: Server sends dates via getMountainISODate(), so the calendar
 * date is already correct. This just creates a Date object for formatting.
 *
 * For server-side calculations, use parseMountainISODate() instead.
 */
function parseLocalDate(isoDateString: string): Date {
  const [year, month, day] = isoDateString.split("-").map(Number);
  return new Date(year, month - 1, day);
}

const date = parseLocalDate("2025-11-26"); // From server
const formatted = format(date, "EEEE, MMMM d"); // "Tuesday, November 26"

✅ Zod Validation

import { futureMountainDateSchema } from "@/schemas/date.schema";

const schema = z.object({
  deliveryDate: futureMountainDateSchema, // Validates YYYY-MM-DD, ensures future
  endDateTime: z.coerce.date(), // For datetime-local inputs
});

✅ Admin UI Best Practices

<DialogDescription>
  All dates and times are in Mountain Time (America/Boise).
  Content will activate based on Mountain Time, regardless of user location.
</DialogDescription>

<div className="grid gap-4">
  <div className="space-y-2">
    <Label htmlFor="startDate">Start Date (MT)</Label>
    <Input id="startDate" type="datetime-local" />
  </div>
  <div className="space-y-2">
    <Label htmlFor="endDate">End Date (MT)</Label>
    <Input id="endDate" type="datetime-local" />
  </div>
</div>

<p className="text-sm text-muted-foreground">
  This content will appear to all users when Mountain Time is between the start and end dates.
</p>

Anti-Patterns to Avoid

❌ WRONG: Direct Date Construction

const now = new Date(); // Uses server timezone (UTC on Cloudflare) or browser timezone
const date = new Date("2025-11-26"); // Parses as UTC midnight = wrong day in MT

❌ WRONG: UTC Serialization

// This converts MT date to UTC, then strips time - causes off-by-one bugs!
deliveryDate: option.deliveryDate.toISOString().split('T')[0]

❌ WRONG: Browser Timezone Hacks

function getIsoDate(date: Date) {
  // DON'T do manual timezone offset calculations
  return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
    .toISOString()
    .split("T")[0];
}

❌ WRONG: Timezone-Specific Strings in Database

// Schema - WRONG
endDate: text(), // "2025-03-15T14:00:00-07:00" - loses DST context

// Schema - CORRECT
endDate: integer({ mode: "timestamp" }), // UTC timestamp

Available Utilities

Core Functions (src/utils/timezone.ts)

Function Purpose Example
getCurrentMountainTime() Get current time in MT const now = getCurrentMountainTime()
toMountainTime(date) Convert any Date to MT const mt = toMountainTime(utcDate)
getMountainISODate(date) Get YYYY-MM-DD in MT const str = getMountainISODate(new Date())
parseMountainISODate(str) Parse YYYY-MM-DD as MT midnight const date = parseMountainISODate("2025-11-26")
getMountainDayOfWeek(date) Get day 0-6 in MT const day = getMountainDayOfWeek(date)
isBeforeMountainCutoff(opts) Check cutoff in MT const ok = isBeforeMountainCutoff({cutoffDay: 2, cutoffTime: "23:59"})
formatMountainTime(date, fmt) Format display in MT formatMountainTime(date, "datetime")
addDaysMountainTime(date, n) Add days handling DST const next = addDaysMountainTime(date, 7)
getNextDayOfWeek(day, from?) Next occurrence of weekday const thu = getNextDayOfWeek(4)

Validation Schemas (src/schemas/date.schema.ts)

Schema Purpose
mountainISODateSchema Validates YYYY-MM-DD format
futureMountainDateSchema Validates future dates only
optionalMountainISODateSchema Optional date field
MountainISODate TypeScript branded type

Recent Timezone Overhaul (Nov 2025)

Critical Bugs Fixed

  1. API Serialization - Changed .toISOString().split('T')[0] → getMountainISODate()
    - File: src/app/(storefront)/_actions/get-fulfillment-options.action.ts

  2. HTML Date Inputs - Changed new Date().toISOString().split('T')[0] → getMountainISODate(new Date())
    - File: src/app/(admin)/admin/delivery-settings/_components/one-off-date-dialog.tsx

  3. Import Errors - Updated date-fns-tz v2 → v3 API
    - Changed zonedTimeToUtc → fromZonedTime
    - Changed utcToZonedTime → toZonedTime

  4. Timezone Offset Hacks Removed - Replaced manual calculations with proper utilities
    - File: src/app/(admin)/admin/orders/_components/fulfillment-filters.tsx

  5. Client Parsing Documentation - Added clear warnings about browser timezone
    - Files: src/components/fulfillment-method-selector.tsx, src/app/(admin)/admin/delivery-settings/_components/one-off-dates-table.tsx

  6. Validation Schemas Added - Created Zod schemas for date validation
    - File: src/schemas/date.schema.ts

  7. Missing Type Exports - Added DeliveryOneOffDate type
    - File: src/db/schema.ts

Reference Implementation

Core Files

  • src/utils/timezone.ts - All timezone utilities (BUSINESS_TIMEZONE = 'America/Boise')
  • src/utils/delivery.ts - Complex delivery date calculations
  • src/utils/format-date.ts - Display formatting in MT
  • src/schemas/date.schema.ts - Zod validation schemas

Server Actions (Examples)

  • src/app/(storefront)/_actions/get-fulfillment-options.action.ts - Proper API serialization
  • src/app/(storefront)/_actions/site-content.action.ts - Active content filtering
  • src/app/(admin)/admin/delivery-settings/_actions/one-off-dates.action.ts - Date validation

Client Components (Examples)

  • src/app/(admin)/admin/delivery-settings/_components/one-off-date-dialog.tsx - HTML date inputs
  • src/components/fulfillment-method-selector.tsx - Client-side date parsing with docs
  • src/app/(admin)/admin/site-content/_components/notification-form-dialog.tsx - Admin UI patterns

Database Schema

  • src/db/schema.ts:643-653 - Home notifications (timestamp pattern)
  • src/db/schema.ts:655-664 - Sales banner (timestamp pattern)
  • src/db/schema.ts:274-295 - Delivery closures & one-off dates (date string pattern)

Testing Checklist

When implementing or modifying date/time features:

  • [ ] Import getCurrentMountainTime from @/utils/timezone
  • [ ] Use MT utilities for all server-side date comparisons
  • [ ] Store timestamps as UTC (integer({ mode: "timestamp" }))
  • [ ] Serialize API responses with getMountainISODate()
  • [ ] Use MT utilities for HTML date input min/max values
  • [ ] Validate inputs with Zod schemas from @/schemas/date.schema.ts
  • [ ] Add timezone labels to admin UI ("Mountain Time" or "MT")
  • [ ] Add timezone comments to time-sensitive code
  • [ ] Document client-side parsing with timezone warnings
  • [ ] Test at 11:59 PM MT (next day in UTC) for off-by-one bugs
  • [ ] Test during DST transitions (March/November)
  • [ ] Test with delivery cutoff times
  • [ ] Test with users in different timezones (verify consistency)

Decision Framework

Ask yourself: "Would this work correctly if a user in Tokyo at 3 AM was viewing content scheduled for 'today' in Mountain Time?"

If the answer is no, you need to use Mountain Time utilities.

Code Comments Template

/**
 * TIMEZONE: Uses Mountain Time (America/Boise) for all date operations.
 * Admin sets dates in MT, backend stores as UTC timestamps,
 * comparisons/calculations use getCurrentMountainTime().
 */

Common Bug Scenarios

  1. Off-by-one bug at night - User sees wrong delivery date at 11 PM MT
    - Cause: .toISOString().split('T')[0] converts to UTC first
    - Fix: Use getMountainISODate()

  2. Cutoff time calculation wrong - Orders placed before cutoff are rejected
    - Cause: Using new Date() instead of getCurrentMountainTime()
    - Fix: Import and use getCurrentMountainTime()

  3. Content shows/hides at wrong time - Banner appears 7 hours early/late
    - Cause: Database comparison using new Date() (UTC on Cloudflare)
    - Fix: Use getCurrentMountainTime() in query

  4. Date picker shows yesterday - HTML input min date is off by one
    - Cause: new Date().toISOString().split('T')[0] in min attribute
    - Fix: Use getMountainISODate(new Date())

Summary

The bakery operates in Mountain Time. Every date/time operation must use Mountain Time utilities to ensure consistent, predictable behavior for all users regardless of their location.

  • Database: Store UTC timestamps
  • Business Logic: Operate in Mountain Time
  • Display: Show Mountain Time
  • Validation: Use MT-aware Zod schemas
  • Documentation: Label timezone in UI and code comments

When in doubt, import from @/utils/timezone.ts and avoid native Date operations.

常见问题

5 问
答案由本站依据条目字段整理
timezone怎么安装?

没有现成安装命令:按安装说明或仓库 README,把 SKILL.md 放进客户端的 skills 目录(一般一个技能一个文件夹)。

timezone支持哪些客户端?

资料没有标注宿主客户端,但只要客户端支持 Skills(Claude、Codex、Cursor 等),一般都能加载。

timezone权限高吗,安全吗?

权限级别为未标注权限。安装前先看它会读取或写入哪些内容。

timezone收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于技能本身和所用的模型或客户端,正式使用前按作者说明确认。

timezone用什么许可证?

许可证标注为 未说明(许可证不明确)。商用或二次分发前请到仓库确认条款原文。

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 未标注。