datetimebuddy
Version:
A lightweight, chainable DateTime utility for JavaScript and TypeScript with UTC support, formatting, and date math.
48 lines (44 loc) • 1.64 kB
Plain Text
> datetimebuddy@2.0.6 test
> vitest run
RUN v0.34.6 C:/Users/goofy/Desktop/Projectes/NPM/DateTimeBuddy
✓ test/datetimebuddy.test.ts (35)
✓ DateTimeBuddy (35)
✓ creates instance with now
✓ creates instance from string and number
✓ adds and subtracts days
✓ adds and subtracts hours and minutes
✓ accesses individual date parts
✓ formats date correctly
✓ compares dates
✓ calculates days between
✓ gets start and end of day
✓ gets start and end of month
✓ gets start and end of year
✓ sets date components
✓ clones the instance
✓ converts to Date and ISO string
✓ handles unix timestamp
✓ applies timezone offset correctly
✓ gets weekday and ISO weekday
✓ gets week number
✓ checks leap year
✓ returns days in month
✓ checks if date is weekend
✓ compares by date only
✓ returns relative time
✓ formats friendly
✓ returns UTC string
✓ returns JSON and ISO string
✓ returns locale string representations
✓ compares dates using compare()
✓ calculates diffIn with various units using Math.floor
✓ gets current week start and end
✓ gets next week start and end
✓ gets previous week start and end
✓ adds weeks
✓ subtracts weeks
✓ handles week boundary logic
Test Files 1 passed (1)
Tests 35 passed (35)
Start at 16:06:42
Duration 531ms (transform 113ms, setup 0ms, collect 122ms, tests 63ms, environment 0ms, prepare 126ms)