start_of_week

datetime

Returns the first day (Monday) of the week for a given date

Syntax

start_of_week(date)

Parameters

date (date|timestamp)

The date to find the start of week for

Returns

date

The Monday of the week (start of week)

Examples

Get Monday of the week
Input:
start_of_week("2024-01-15")
Output:
"2024-01-15"
Get week start from field
Input:
.date | start_of_week
Output:
"2024-01-15"
Get current week data
Input:
map(select(.date >= start_of_week(today())))
Output:
Filter week-to-date records

The start_of_week() function returns the first day (Monday) of the week for a given date, useful for week-based grouping and filtering.

Usage

Use start_of_week() to find week boundaries, group data by week, filter week-to-date data, or calculate week-based date ranges.