end_of_week
datetimeReturns the last day (Sunday) of the week for a given date
Syntax
end_of_week(date) Parameters
date (date|timestamp) The date to find the end of week for
Returns
date The Sunday of the week (end of week)
Examples
Get Sunday of the week
Input:
end_of_week("2024-01-15") Output:
"2024-01-21" Get week end from field
Input:
.date | end_of_week Output:
"2024-01-21" Get complete week data
Input:
map(select(.date >= start_of_week(today()) and .date <= end_of_week(today()))) Output:
Filter current week records The end_of_week() function returns the last day (Sunday) of the week for a given date, useful for defining week boundaries and week-based filtering.
Usage
Use end_of_week() to find week boundaries, calculate week-based date ranges, filter data within a week, or group events by complete weeks.