Hour

Learn how to filter by, read, update, and clear the hour column on monday boards using the platform API

The hour column contains a specific time entry for an item in HH:MM format. The API allows you to read, filter, update, and clear the hour column.

Read an hour column

You can query the hour column using the column_values object that enables you to return column-specific subfields by sending a fragment in your query. Values for the hour column are of the HourValue type.

query {
  items (ids:[1234567890, 9876543210]) {
    column_values {
      ... on HourValue {
        minute
        hour
      }
    }
  }
}
import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });

const query = `query($itemIds: [ID!], $columnType:[ColumnType!]) { items (ids:$itemIds) { id column_values (types:$columnType) { column { title id } ... on HourValue { minute hour } } } }`;
const variables = {
  itemIds: [9571351485, 9572374902],
  columnType: "hour"
};

const response = await mondayApiClient.request(query, variables);

Fields

FieldDescription
column Column!The column the value belongs to.
hour IntThe column's hour value.
id ID!The column's unique identifier.
minute IntThe column's minute value.
text StringThe column's value as text. This field will return "" if the column has an empty value.
type ColumnType!The column's type.
updated_at DateThe column's last updated date.
value JSONThe column's JSON-formatted raw value.

Filter an hour column

Using the items_page object, you can easily filter a board's items by specific columns or column values. The table below contains the hour column's supported operators and compare values.

Operators

Compare values

any_of

  • "Early morning"
  • "Morning"
  • "Afternoon"
  • "Evening"
  • "Night"

not_any_of

  • "Early morning"
  • "Morning"
  • "Afternoon"
  • "Evening"
  • "Night"

is_empty

null

is_not_empty

null

Compare values

The hour column takes a set of predefined compare values to align with the filtering options in the UI. Please note that these times are based on the monday.com timezone configuration of the user making the API call.

  • Early morning: 4:00 - 7:00 AM
  • Morning: 7:00 AM - 12:00 PM
  • Afternoon: 12:00 - 8:00 PM
  • Evening: 8:00 - 11:00 PM
  • Night: 11:00 PM - 4:00 AM

Examples

The following example returns all items on the specified board with an hour column value in the afternoon.

query {
  boards(ids: 1234567890) {
    items_page(
      query_params: {
        rules: [
          {
            column_id: "hour"
            compare_value: ["Afternoon"]
            operator: any_of
          }
        ]
      }
    ) {
      items {
        id
        name
      }
    }
  }
}
import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });

const query = `query ($board_id: [ID!], $column_id: ID!, $operator: ItemsQueryRuleOperator!, $compare_value:CompareValue!) { boards (ids: $board_id) { items_page (query_params: {rules: [{column_id: $column_id, compare_value: $compare_value,  operator:$operator}]}) { items { id name } } } }`;
const variables = {
  board_id: 9571351437,
  column_id: "hour_mksvv75n",
  compare_value: ["Afternoon"], 
  operator: "any_of",
};

const response = await mondayApiClient.request(query, variables);

Update an hour column

You can update an hour column using the change_multiple_column_values mutation and passing a JSON string in the column_values argument. Simple string updates are not supported.

JSON

To update an hour column, send the hour and minute in 24-hour format. Make sure you remove any leading zeroes from the data you send (i.e., send the number 9 instead of 09).

mutation {
  change_multiple_column_values(
    item_id: 9876543210
    board_id: 1234567890
    column_values: "{\"hour\": {\"hour\": 16, \"minute\": 42}}"
  ) {
    id
  }
}
import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });

const query = `mutation ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
  myBoardId: 9571351437,
  myItemId: 9571351485,
  myColumnValues: JSON.stringify({
    hour_mksvv75n: { // hour_mksvv75n is the column ID
      hour: 20,
      minute: 20,
    }
  }),
};

const response = await mondayApiClient.request(query, variables); 

Clear an hour column

You can also clear an hour column using the change_multiple_column_values mutation and passing null or an empty object in the column_values argument.

mutation {
  change_multiple_column_values(
    item_id: 9876543210
    board_id: 1234567890
    column_values: "{\"hour\": null}"
  ) {
    id
  }
}
import { ApiClient } from "@mondaydotcomorg/api";
const mondayApiClient = new ApiClient({ token: myToken });

const query = `mutation ($myBoardId:ID!, $myItemId:ID!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }`;
const variables = {
  myBoardId: 9571351437,
  myItemId: 9571351485,
  myColumnValues: JSON.stringify({
    hour_mksvv75n: null
  }),
};

const response = await mondayApiClient.request(query, variables);