Read, filter, update, and clear week columns using the monday.com platform API
The week column represents a week-long date range based on the dates you select. The start and end dates adapt to the first-day-of-week settings configured in the monday.com account.
Via the API, the week column supports read, filter, update, and clear operations.
Column Type | Implementation Type | Supported Operations |
|---|---|---|
|
|
|
Queries
Week columns can be queried through the column_values field on items queries using an inline fragment on WeekValue.
query {
items(ids: [1234567890, 9876543210]) {
column_values {
... on WeekValue {
start_date
end_date
}
}
}
}Fields
You can use the following fields to specify what information your WeekValue implementation will return.
| Field | Description |
|---|---|
column Column! | The column the value belongs to. |
end_date Date | The week's end date. |
id ID! | The column's unique identifier. |
start_date Date | The column's start date. |
text String | The week range (YYYY-MM-DD format). Returns "" if the column has an empty value. |
type ColumnType! | The column's type. |
value JSON | The column's JSON-formatted raw value. |
Filter
You can filter items by week values using the items_page object. The week column supports the following operators:
Operators | Compare Values |
|---|---|
|
|
|
|
|
|
|
|
Example
The following example returns items with a week column value in past weeks.
query {
boards(ids: 1234567890) {
items_page(
query_params: {
rules: [
{
column_id: "week"
compare_value: ["PAST_WEEKS"]
operator: any_of
}
]
}
) {
items {
id
name
}
}
}
}Mutations
Update
You can update a week column using change_multiple_column_values by passing a JSON object in column_values.
Send the startDate and endDate keys in YYYY-MM-DD format. Dates must span exactly one week and begin on the correct first day of the week.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"week\": {\"week\": {\"startDate\": \"2019-06-10\", \"endDate\": \"2019-06-16\"}}}"
) {
id
}
}Clear
You can clear a week column using change_multiple_column_values by passing null or an empty object in column_values.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"week\": null}"
) {
id
}
}