Viniciustda/OiTenta / .agents/skills/config-package-shared
config-package-shared
VerifiedReconstrói o pacote compartilhado base da aplicação, concentrando contratos reutilizáveis, classes base, erros de domínio, casos de uso e validações consumidas pelo backend, frontend e módulos de negócio.
assets/shared-template/src/validation/rules/date-string.rule.ts
View on GitHubimport { validateStringValues } from "../rule.utils";
import { ValidationRule } from "../validation-rule.interface";
function isValidDateParts(year: number, month: number, day: number): boolean {
const date = new Date(Date.UTC(year, month - 1, day));
return (
date.getUTCFullYear() === year &&
date.getUTCMonth() === month - 1 &&
date.getUTCDate() === day
);
}
function isValidIsoDateString(value: string): boolean {
const dateOnlyMatch = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
if (dateOnlyMatch !== null) {
const [, year, month, day] = dateOnlyMatch;
return isValidDateParts(Number(year), Number(month), Number(day));
}
const dateTimeMatch = value.match(
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/,
);
if (dateTimeMatch === null) {
return false;
}
const [, year, month, day, hour, minute, second = "0", , timezone] =
dateTimeMatch;
const timezoneMatch =
timezone?.match(/^([+-])(\d{2}):(\d{2})$/) ?? null;
if (
!isValidDateParts(Number(year), Number(month), Number(day)) ||
Number(hour) > 23 ||
Number(minute) > 59 ||
Number(second) > 59
) {
return false;
}
if (timezoneMatch === null) {
return true;
}
const [, , timezoneHours, timezoneMinutes] = timezoneMatch;
return Number(timezoneHours) <= 23 && Number(timezoneMinutes) <= 59;
}
export class DateStringRule implements ValidationRule {
validate(value: unknown): string | null {
return validateStringValues(
value,
"date.string",
(item) => isValidIsoDateString(item),
);
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |