BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shuip/time

time

shuip/time
FreeUtility

shuip publishes no description for this item.

Install it

npx shadcn@latest add https://shuip.plvo.dev/r/time.json

Source

./items/lib/time/time.tsshuip.plvo.dev/r/time.json
1export const MINUTE_STEP = 5;
2
3export const HOUR_OPTIONS: string[] = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, '0'));
4
5export const MINUTE_OPTIONS: string[] = Array.from({ length: 60 / MINUTE_STEP }, (_, i) =>
6 String(i * MINUTE_STEP).padStart(2, '0'),
7);
8
9export type TimeRangeValue = { start: string; end: string };
10
11export function splitTime(time: string): { hour: string; minute: string } {
12 const [hour = '', minute = ''] = time.split(':');
13 return { hour, minute };
14}
15
16export function joinTime(hour: string, minute: string): string {
17 if (!hour && !minute) return '';
18 return `${hour || '00'}:${minute || '00'}`;
19}
20
21export function toMinutes(time: string): number | null {
22 const { hour, minute } = splitTime(time);
23 if (!hour || !minute) return null;
24 const h = Number(hour);
25 const m = Number(minute);
26 if (Number.isNaN(h) || Number.isNaN(m)) return null;
27 return h * 60 + m;
28}
29
30export function fromMinutes(total: number): string {
31 const clamped = Math.max(0, Math.min(total, 24 * 60 - MINUTE_STEP));
32 const h = Math.floor(clamped / 60);
33 const m = clamped % 60;
34 return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
35}
36
37export function addOneHour(time: string): string {
38 const minutes = toMinutes(time);
39 if (minutes === null) return time;
40 return fromMinutes(minutes + 60);
41}
42
43export function nextSlot(time: string): string {
44 const minutes = toMinutes(time);
45 if (minutes === null) return time;
46 return fromMinutes(minutes + MINUTE_STEP);
47}
48
49export function isHourDisabled(hour: string, bounds?: { min?: string; max?: string }): boolean {
50 if (!hour) return false;
51 const h = Number(hour);
52 if (Number.isNaN(h)) return false;
53 const hourStart = h * 60;
54 const hourEnd = h * 60 + 55;
55 const min = bounds?.min ? toMinutes(bounds.min) : null;
56 const max = bounds?.max ? toMinutes(bounds.max) : null;
57 if (min !== null && hourEnd < min) return true;
58 if (max !== null && hourStart > max) return true;
59 return false;
60}
61
62export function isMinuteDisabled(minute: string, hour: string, bounds?: { min?: string; max?: string }): boolean {
63 if (!hour || !minute) return false;
64 const t = toMinutes(joinTime(hour, minute));
65 if (t === null) return false;
66 const min = bounds?.min ? toMinutes(bounds.min) : null;
67 const max = bounds?.max ? toMinutes(bounds.max) : null;
68 if (min !== null && t < min) return true;
69 if (max !== null && t > max) return true;
70 return false;
71}

Files it writes

  • ./items/lib/time/time.ts

Facts

Registry
shuip
Type
registry:lib
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

shuip.plvo.dev Raw registry item This item as JSON

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex