Skip to main content

Date Helpers

Utility functions for working with dates.

Functions

FunctionDescription
compareComparison of two dates.
daysDifferenceGets the difference in days between two dates
toISO8601Converts a date to ISO 8601 format
toRFC3339Converts a date to RFC 3339 format
toRFC2822Converts a date to RFC 2822 format
isSameDayChecks if two dates are the same day
safeDateSafely creates a Date object from various input types
dateToISOStringFormats a date to ISO string or returns null
isTimestampInSecondsChecks if a timestamp is likely in seconds (Java/Unix style) vs milliseconds (JavaScript style)
normalizeTimestampConverts a timestamp to JavaScript milliseconds format