Skip to content

Add date entry commands + date format setting + year range 1964-2066#2165

Open
Mark-Phillipson wants to merge 13 commits into
talonhub:mainfrom
Mark-Phillipson:feature_date_entry
Open

Add date entry commands + date format setting + year range 1964-2066#2165
Mark-Phillipson wants to merge 13 commits into
talonhub:mainfrom
Mark-Phillipson:feature_date_entry

Conversation

@Mark-Phillipson
Copy link
Copy Markdown
Contributor

Summary

Add new voice date entry commands with a centralized date format setting and extended year range.

Features implemented

  • New voice commands in core/dates/date_entry.talon:

    • date {user.day} {user.month} {user.year} (default dd/mm/yyyy)
    • date {user.day} {user.month} {user.year} us (mm/dd/yyyy)
    • date {user.day} {user.month} {user.year} iso (yyyy-mm-dd)
    • date today / date now (relative, format from setting)
    • date tomorrow
    • date yesterday
    • date next {user.weekday} (relational weekday)
    • date next month
    • date next year
    • date last year
  • Centralized formatting in core/dates/date_lists.py:

    • settings.user.date_format supports uk (default), us, iso
    • action methods: insert_date_formatted, insert_date_formatted_us, insert_date_formatted_iso,
      insert_date_today, insert_date_tomorrow, insert_date_yesterday, insert_date_next_weekday
  • Year list expanded to 1964-2066 in core/dates/year.talon-list.

  • All list data are in .talon-list files:

    • day.talon-list, month.talon-list, year.talon-list, weekdays.talon-list

Demonstration commands (voice -> typed output)

Examples with ordinal spoken forms.

Spoken command Expected typed output
date twenty first august twenty twenty five 21/08/2025
date twenty first august twenty twenty five us 08/21/2025
date twenty first august twenty twenty five iso 2025-08-21

Relative examples assuming today is 2026-03-27 and user.date_format=uk.

Spoken command Expected typed output
date today 27/03/2026
date now 27/03/2026
date tomorrow 28/03/2026
date yesterday 26/03/2026
date next monday 30/03/2026
date next month 27/04/2026
date next year 27/03/2027
date last year 27/03/2025

Copilot AI review requested due to automatic review settings March 27, 2026 16:26
Copy link
Copy Markdown

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 voice-driven date entry commands, backed by centralized date formatting and expanded spoken date component lists (day/month/year/weekday).

Changes:

  • Introduces date … voice commands for absolute dates plus relative dates (today/tomorrow/yesterday/next weekday/month/year/last year).
  • Adds a user.date_format setting (uk/us/iso) and Python actions to format/insert dates consistently.
  • Adds/expands .talon-list files for user.day, user.month, user.year (1964–2066), and user.weekday.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
core/dates/date_entry.talon Defines new spoken commands for absolute/relative date insertion and references the new actions/setting.
core/dates/date_lists.py Implements date formatting setting + insertion actions for absolute and relative dates.
core/dates/day.talon-list Adds spoken forms for days (ordinal + numeric) mapped to 1–31.
core/dates/month.talon-list Adds month name → month number mappings.
core/dates/weekdays.talon-list Adds weekday name list used by “date next {weekday}”.
core/dates/year.talon-list Adds year spoken forms mapped to 1964–2066.

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

Comment thread core/dates/date_entry.talon Outdated
Comment thread core/dates/date_lists.py Outdated
Comment thread core/dates/date_lists.py
Comment thread core/dates/date_entry.talon Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd09c4380d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread core/dates/date_lists.py Outdated
Mark-Phillipson and others added 5 commits March 27, 2026 16:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@chdoc chdoc left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request. However, while I do think that date entry could be significantly improved, I think that this will need significant revisions before it can be merged.

Comment thread core/dates/date_entry.talon Outdated
@@ -0,0 +1,32 @@
# Date entry commands using day, month, year lists
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see a reason why this should be part of core. We already have plugin/datetimeinsert, which this could extend.

Comment thread core/dates/date_lists.py Outdated
mod = Module()

# Declare lists in Talon grammar; values come from talon-list files
mod.list("day", "Ordinal and numeric day values (1-31)")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no reason to introduce a .talon file for this. Please use get_spoken_form_under_one_hundred.

Comment thread core/dates/date_lists.py Outdated
# Declare lists in Talon grammar; values come from talon-list files
mod.list("day", "Ordinal and numeric day values (1-31)")
mod.list("month", "Month names and numeric values (1-12)")
mod.list("year", "Year values from 1964 to 2066")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also don't think there is any reason to unroll years. The capture <user.number> is a specifically designed to be flexible enough for entering years. Also, there is no reason to restrict to this range.

Comment thread core/dates/date_lists.py Outdated
Comment on lines +38 to +72
def insert_date_from_parts(day: str, month: str, year: str):
"""Insert date from spoken day/month/year using preferred date_format"""
day_padded = day.zfill(2)
month_padded = month.zfill(2)
year_num = int(year)
month_num = int(month_padded)
day_num = int(day_padded)
try:
computed = date(year_num, month_num, day_num)
actions.insert(_format_with_preference(computed))
except ValueError:
# Fall back to inserting an unvalidated formatted string to avoid errors
date_str = f"{day_padded}/{month_padded}/{year}"
actions.insert(date_str)

def insert_date_formatted(day: str, month: str, year: str):
"""Insert a formatted date from spoken day/month/year as dd/mm/yyyy"""
day_padded = day.zfill(2)
month_padded = month.zfill(2)
date_str = f"{day_padded}/{month_padded}/{year}"
actions.insert(date_str)

def insert_date_formatted_us(day: str, month: str, year: str):
"""Insert a formatted date from spoken day/month/year as mm/dd/yyyy"""
day_padded = day.zfill(2)
month_padded = month.zfill(2)
date_str = f"{month_padded}/{day_padded}/{year}"
actions.insert(date_str)

def insert_date_formatted_iso(day: str, month: str, year: str):
"""Insert a formatted date from spoken day/month/year as yyyy-mm-dd"""
day_padded = day.zfill(2)
month_padded = month.zfill(2)
date_str = f"{year}-{month_padded}-{day_padded}"
actions.insert(date_str)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see a reason for these functions to take strings as arguments. Conversions from spoken words to numbers should be done by using appropriate captures in the commands.

Comment thread core/dates/date_entry.talon Outdated
Comment on lines +4 to +14
date {user.day} {user.month} {user.year}:
user.insert_date_from_parts(day, month, year)

# Insert date as US format mm/dd/yyyy
# (default remains dd/mm/yyyy for standard use)
date {user.day} {user.month} {user.year} us:
user.insert_date_formatted_us(day, month, year)

# Insert date as ISO format yyyy-mm-dd
date {user.day} {user.month} {user.year} iso:
user.insert_date_formatted_iso(day, month, year)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If anything, these should all call the same action: user.insert_date_formatted(day, month, year, format), format being an optional argument.

Comment thread core/dates/date_entry.talon Outdated

# Relative date commands
# Today/now uses list default or settings format
date today: user.insert_date_today()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is actually the existing date insert command. I would be in favor of deprecating that command, but this needs to be done and recorded in the breaking changes file.

Comment thread core/dates/date_entry.talon Outdated
Copy link
Copy Markdown
Collaborator

@nriley nriley left a comment

Choose a reason for hiding this comment

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

From the community backlog session — we agree with @chdoc 's comments. Thanks for the contribution.

Mark-Phillipson and others added 2 commits May 3, 2026 10:03
…plement new date handling in date_lists.py

Co-authored-by: Copilot <copilot@github.com>
… today's date and update month list format

Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown
Contributor Author

@Mark-Phillipson Mark-Phillipson left a comment

Choose a reason for hiding this comment

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

I have made the recommended changes except the month entry. From a user experience (UX) perspective, I think we need to stick with saying the months. As opposed to the numbers representing the month.

Now, voice input allows entry of invalid dates. Because we are using existing lists, app Notify will pop up Notifying the user. However the invalid date will still be inserted.

Comment thread plugin/datetimeinsert/datetimeinsert.talon Outdated
Comment thread plugin/datetimeinsert/date_lists.py Outdated
Comment thread plugin/datetimeinsert/date_lists.py Outdated
Comment thread plugin/datetimeinsert/date_lists.py Outdated
Comment thread plugin/datetimeinsert/date_lists.py
Comment thread plugin/datetimeinsert/date_lists.py
@nriley
Copy link
Copy Markdown
Collaborator

nriley commented May 9, 2026

From the community backlog session — we agree with @chdoc 's comments (again). Thanks!

…te today` and `date today UTC` commands. Update month and weekday lists, and refactor date handling in `date_lists.py`.
@Mark-Phillipson
Copy link
Copy Markdown
Contributor Author

We are now using the Talon List day.talon-list again. Made requested changes.

…ation messages to suggest using `date today` and `date today UTC` instead.
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.

4 participants