Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api-docs: Document date operator in constructing a narrow.
Apoorva Pendsedd5adc2de6c4
diff --git a/api_docs/construct-narrow.md b/api_docs/construct-narrow.mdindex 9b71cde7367..d67705a6d8c 100644--- a/api_docs/construct-narrow.md+++ b/api_docs/construct-narrow.md@@ -142,16 +142,6 @@ conversation (i.e., they contain `channel` and `topic` terms or `dm`term). This behavior is intended to provide the best possibleexperience for links to private channels with protected history.-The [help center](/help/search-for-messages#search-by-message-id) also-documents the `near` operator for searching for messages by ID, but-this narrow operator has no effect on filtering messages when sent to-the server. In practice, when the `near` operator is used to search for-messages, or is part of a URL fragment, the value of its operand should-instead be used for the value of the `anchor` parameter in endpoints-that also accept a `narrow` parameter; see-[GET /messages][anchor-get-messages] and-[POST /messages/flags/narrow][anchor-post-flags].-**Changes**: Prior to Zulip 8.0 (feature level 194), the message IDoperand for the `id` operator needed to be encoded as a string.@@ -204,7 +194,59 @@ user 1234, and user 5678, the correct JSON-encoded query is:]```+## Narrow terms that don't filter messages++The help center documents the+[`near` operator](/help/search-for-messages#search-by-message-id)+for searching for messages by ID and the+[`date` operator](/help/search-for-messages#search-by-date)+for searching for messages by date. But neither operator has an effect+on filtering messages when sent to the server, and should be omitted+when constructing the set of filters for a narrow. These terms may+appear in a [URL used or generated by the Zulip web app](/api/zulip-urls).++### The `near` operator++The `near` operator is designed to be used for [permanent links to+messages](/help/link-to-a-message-or-conversation#get-a-link-to-a-specific-message),+which means they should continue to work when the message is moved (to+another [channel](/help/move-content-to-another-channel) and/or+[topic](/help/move-content-to-another-topic)), or when a topic is+[resolved](/help/resolve-a-topic). The value of its operand is a message+ID.++A permanent link to a message will have a URL with only three narrow terms:+a `channel` term, a `topic` term and a `near` term. When this is the+case, clients should use the `near` term's message ID to find where the+message is now, and check if the current user has access to that message.+The message may either be in the client's current locally fetched message+data, or can be fetched by passing the message ID in the `message_ids`+parameter to [GET /messages](/api/get-messages#parameter-message_ids).++Otherwise, when the `near` operator is used to search for messages, clients+should instead use the message ID for value of the `anchor` parameter in+endpoints that also accept a `narrow` parameter; see+[GET /messages][anchor-get-messages] and+[POST /messages/flags/narrow][anchor-post-flags].++### The `date` operator++When the `date` operator is used to search for messages, or is part of a+URL fragment, clients should instead use the special `date` value for the+[`anchor` parameter][anchor-get-messages], and use the value of the+operand to set the [`anchor_date` parameter][anchor-date-param] when+fetching messages. Unlike the `near` operator, the `date` operator is only+supported by the [`GET /messages`](/api/get-messages) endpoint.++The value of the `date` operator's operand should be an ISO 8601 date-only+string (e.g., `"2025-12-01"`), which is a valid value for the [`anchor_date`+parameter][anchor-date-param]. But, when possible, clients should convert+that calendar date to the current user's local timezone's midnight, and set+the value of the `anchor_date` parameter as a full datetime string (e.g.,+`"2025-12-01T00:00:00+01:00"`).+[view-profile]: /help/view-someones-profile[browse-channels]: /help/introduction-to-channels#browse-and-subscribe-to-channels[anchor-get-messages]: /api/get-messages#parameter-anchor[anchor-post-flags]: /api/update-message-flags-for-narrow#parameter-anchor+[anchor-date-param]: /api/get-messages#parameter-anchor_datediff --git a/api_docs/zulip-urls.md b/api_docs/zulip-urls.mdindex 8a5f0279c17..49adee34155 100644--- a/api_docs/zulip-urls.md+++ b/api_docs/zulip-urls.md@@ -29,6 +29,11 @@ is the feed of starred messages sent by user ID to everywhere butchannel 14. The search documentation covers the valid operators andtheir meaning.+Note that there are a couple of specialized operator/operand pairs+that appear in message feed URLs that are used to [anchor the message+feed view](/api/construct-narrow#narrow-terms-that-dont-filter-messages)+around a message ID or a date, and not as search filters.+See also the relevant [message formattingdocumentation](/api/message-formatting) for details on Markdownrepresentations of Zulip-internal links that will be translated into