Skip to content

Add support for "After The Weekend" and "Before The Weekend" expressions#136

Merged
mihxil merged 2 commits intomainfrom
copilot/add-after-before-weekend-support
Feb 23, 2026
Merged

Add support for "After The Weekend" and "Before The Weekend" expressions#136
mihxil merged 2 commits intomainfrom
copilot/add-after-before-weekend-support

Conversation

Copy link

Copilot AI commented Feb 23, 2026

Two new relative date expressions were not recognized by the parser:

  • After The Weekend → the Monday following the upcoming weekend
  • Before The Weekend → the Friday immediately before the upcoming weekend

Grammar (DateParser.g)

Added two alternatives to the relative_date rule. The lexer already maps "weekend"SATURDAY, so these phrases tokenize naturally:

// after the weekend -> next monday
| AFTER WHITE_SPACE THE WHITE_SPACE SATURDAY
    -> ^(RELATIVE_DATE ^(SEEK DIRECTION[">"] SEEK_BY["by_day"] INT["1"] ^(DAY_OF_WEEK INT["2"])))

// before the weekend -> next friday
| BEFORE WHITE_SPACE THE WHITE_SPACE SATURDAY
    -> ^(RELATIVE_DATE ^(SEEK DIRECTION[">"] SEEK_BY["by_day"] INT["1"] ^(DAY_OF_WEEK INT["6"])))

Both expressions are case-insensitive via the existing ANTLRNoCaseInputStream. No changes to the walker or WalkerState were needed — the produced AST nodes reuse the existing seekToDayOfWeek path.

Tests (DateTest.java)

Added four cases against the existing reference date of Feb 28, 2011 (Monday), where the upcoming weekend is Mar 5–6:

Expression Result
"after the weekend" / "After The Weekend" March 7, 2011
"before the weekend" / "Before The Weekend" March 4, 2011
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Add support for After/Before The Weekend</issue_title>
<issue_description>Add support for the following expressions:

  • After The Weekend: Return the next Monday that comes after the upcoming weekend.
  • Before The Weekend: Return the Friday immediately before the upcoming weekend.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mihxil <429477+mihxil@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for after and before the weekend Add support for "After The Weekend" and "Before The Weekend" expressions Feb 23, 2026
Copilot AI requested a review from mihxil February 23, 2026 12:30
@mihxil mihxil marked this pull request as ready for review February 23, 2026 22:13
@mihxil mihxil merged commit 3b43fcc into main Feb 23, 2026
6 checks passed
@mihxil mihxil deleted the copilot/add-after-before-weekend-support branch February 23, 2026 22:13
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.

[Feature] Add support for After/Before The Weekend

2 participants