@itu/utils

Shared utility functions used across the monorepo.

Functions

formatDate(date: string | Date, locale?: string): string

Formats a date using dayjs with locale-aware output.

tsx
import { formatDate } from '@itu/utils'
 
formatDate('2026-04-12') // "April 12, 2026"
formatDate('2026-04-12', 'fr') // "12 avril 2026"
4 lines of tsx code

slugify(text: string): string

Converts text to a URL-safe slug.

tsx
import { slugify } from '@itu/utils'
 
slugify('Hello World!') // "hello-world"
3 lines of tsx code

clamp(value: number, min: number, max: number): number

Clamps a number within a range.

tsx
import { clamp } from '@itu/utils'
 
clamp(150, 0, 100) // 100
3 lines of tsx code