Add date entry commands + date format setting + year range 1964-2066#2165
Add date entry commands + date format setting + year range 1964-2066#2165Mark-Phillipson wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
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_formatsetting (uk/us/iso) and Python actions to format/insert dates consistently. - Adds/expands
.talon-listfiles foruser.day,user.month,user.year(1964–2066), anduser.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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 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".
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>
…ture_date_entry_clean
chdoc
left a comment
There was a problem hiding this comment.
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.
| @@ -0,0 +1,32 @@ | |||
| # Date entry commands using day, month, year lists | |||
There was a problem hiding this comment.
I don't see a reason why this should be part of core. We already have plugin/datetimeinsert, which this could extend.
| mod = Module() | ||
|
|
||
| # Declare lists in Talon grammar; values come from talon-list files | ||
| mod.list("day", "Ordinal and numeric day values (1-31)") |
There was a problem hiding this comment.
There is no reason to introduce a .talon file for this. Please use get_spoken_form_under_one_hundred.
| # 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") |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
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.
| 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) |
There was a problem hiding this comment.
If anything, these should all call the same action: user.insert_date_formatted(day, month, year, format), format being an optional argument.
|
|
||
| # Relative date commands | ||
| # Today/now uses list default or settings format | ||
| date today: user.insert_date_today() |
There was a problem hiding this comment.
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.
…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>
Mark-Phillipson
left a comment
There was a problem hiding this comment.
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.
…try_clean changes for conflicting files
|
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`.
|
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.
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 tomorrowdate yesterdaydate next {user.weekday}(relational weekday)date next monthdate next yeardate last yearCentralized formatting in
core/dates/date_lists.py:settings.user.date_formatsupportsuk(default),us,isoinsert_date_formatted,insert_date_formatted_us,insert_date_formatted_iso,insert_date_today,insert_date_tomorrow,insert_date_yesterday,insert_date_next_weekdayYear list expanded to 1964-2066 in
core/dates/year.talon-list.All list data are in
.talon-listfiles:day.talon-list,month.talon-list,year.talon-list,weekdays.talon-listDemonstration commands (voice -> typed output)
Examples with ordinal spoken forms.
date twenty first august twenty twenty five21/08/2025date twenty first august twenty twenty five us08/21/2025date twenty first august twenty twenty five iso2025-08-21Relative examples assuming today is 2026-03-27 and
user.date_format=uk.date today27/03/2026date now27/03/2026date tomorrow28/03/2026date yesterday26/03/2026date next monday30/03/2026date next month27/04/2026date next year27/03/2027date last year27/03/2025