Home / Function/ formatSelectedDateRange() — supabase Function Reference

formatSelectedDateRange() — supabase Function Reference

Architecture documentation for the formatSelectedDateRange() function in AuditLogs.utils.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/interfaces/Organization/AuditLogs/AuditLogs.utils.ts lines 9–34

export const formatSelectedDateRange = (value: DatePickerToFrom) => {
  const current = dayjs()
  const from = dayjs(value.from)
    .hour(current.hour())
    .minute(current.minute())
    .second(current.second())
  const to = dayjs(value.to).hour(current.hour()).minute(current.minute()).second(current.second())

  if (from.date() === to.date()) {
    // [Joshen] If a single date is selected, we either set the "from" to start from 00:00
    // or "to" to end at 23:59 depending on which date was selected
    if (from.date() === current.date()) {
      return {
        from: from.set('hour', 0).set('minute', 0).set('second', 0).utc().toISOString(),
        to: to.utc().toISOString(),
      }
    } else {
      return {
        from: from.utc().toISOString(),
        to: to.set('hour', 23).set('minute', 59).set('second', 59).utc().toISOString(),
      }
    }
  } else {
    return { from: from.utc().toISOString(), to: to.utc().toISOString() }
  }
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free