Skip to content

feat: add date_time MessageEntity#58

Merged
KnightNiwrem merged 4 commits into
grammyjs:masterfrom
KnightNiwrem:master
Mar 13, 2026
Merged

feat: add date_time MessageEntity#58
KnightNiwrem merged 4 commits into
grammyjs:masterfrom
KnightNiwrem:master

Conversation

@KnightNiwrem
Copy link
Copy Markdown
Collaborator

This pull request adds support for Telegram's date_time message entity, allowing formatted strings to include date and time metadata. The changes upgrade the grammy dependency, update types, add new utility and formatting methods for date_time, and introduce comprehensive tests to ensure correct functionality and consolidation behavior.

Date_time entity support:

  • Added a new time function in src/entity-tag.ts to create date_time entity tags, and updated the buildFormatter function to support this entity type.
  • Introduced static and instance time methods in the FormattedString class to allow easy creation and combination of date_time formatted strings. [1] [2]
  • Added date_time handling to utility functions for entity comparison, consolidation, and sorting in src/util.ts. [1] [2] [3]

Dependency and type updates:

  • Upgraded the grammy dependency in package.json and updated the Deno types import to match the new version. [1] [2]

Testing:

  • Added new test files for date_time entity formatting and utility functions, covering creation, comparison, and consolidation. [1] [2]

Copilot AI review requested due to automatic review settings March 13, 2026 13:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for Telegram’s date_time MessageEntity across the formatting/tag API and entity utilities, aligned with a grammy version bump that exposes the new entity type.

Changes:

  • Upgrade grammy dependency and Deno type import to a version that includes date_time.
  • Add date_time support to entity-tag creation (time), FormattedString composition, and entity similarity/consolidation/sorting utilities.
  • Introduce focused tests for date_time formatting and util behaviors (similarity/equality/consolidation).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/entity-tag.ts Refactors buildFormatter and adds time() tag generator for date_time.
src/format.ts Adds FormattedString.time static + instance helpers built on the new entity tag.
src/util.ts Extends entity similarity, consolidation keying, and deterministic sorting to account for date_time metadata.
test/format.time.test.ts Verifies FormattedString.time creates correct date_time entities (with/without format).
test/util.date_time.test.ts Verifies util equality/similarity and consolidation behavior for date_time.
src/deps.deno.ts Updates Deno type import for grammy.
package.json Bumps grammy in dev + peer dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/entity-tag.ts
Comment thread src/entity-tag.ts
@KnightNiwrem KnightNiwrem merged commit 72a38cd into grammyjs:master Mar 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants