Goluca: add period anchor suffixes (^ and $) to datetime #1

Open
opened 2026-08-07 14:23:43 +00:00 by hum3 · 0 comments
Owner

Proposal

Add two optional suffixes to datetime that indicate whether the value represents the start or end of the period implied by the date:

  • ^ — start of period (e.g. 2024-01-15^ = start of Jan 15th, i.e. 00:00:00)
  • $ — end of period (e.g. 2024-01-31$ = end of Jan 31st, i.e. 23:59:59.999...)
  • No suffix — point in time (existing behaviour, unchanged)

Motivation

A date like 2024-01-15 is ambiguous: it could mean a point in time, or it could represent the whole day as a period. This matters for:

  • Data points: 2024-01-31$ data monthly:close balance — the closing balance is at the end of the day
  • Period boundaries: 2024-01-01^ data quarterly:report start — report starts at beginning of the day
  • Transactions: 2024-12-31$T23:59:59 * Year-end close — explicitly end-of-period

Most systems handle this by convention or context. Making it explicit in the syntax removes ambiguity.

Syntax

Borrowed from regex anchor semantics (^ = start, $ = end), which are universally understood by developers. This appears to be novel — no other PTA format or date standard uses single-character period anchors on dates.

ABNF change

; Current
datetime = date ["T" time timezone]

; Proposed
datetime = date ["T" time [fractional] [timezone]] [period_anchor]
period_anchor = "^" / "$"

Examples

2024-01-15^ data quarterly:report start     ; start of Jan 15
2024-01-31$ data monthly:close balance       ; end of Jan 31
2024-12-31T23:59:59$ * Year-end close        ; end of period with full datetime
2024-01-15 * Normal transaction              ; point in time (unchanged)

Implementation

Already implemented in tree-sitter-goluca on branch task/WTfix with passing tests.

Documentation to update

  • docs/goluca.md — proposed ABNF, datetime section, characteristics table
  • docs/goluca-datetime.md — period anchor semantics and examples

Migrated from Codeberg: originally #1, opened 2026-03-15.

## Proposal Add two optional suffixes to `datetime` that indicate whether the value represents the **start** or **end** of the period implied by the date: - `^` — start of period (e.g. `2024-01-15^` = start of Jan 15th, i.e. `00:00:00`) - `$` — end of period (e.g. `2024-01-31$` = end of Jan 31st, i.e. `23:59:59.999...`) - No suffix — point in time (existing behaviour, unchanged) ### Motivation A date like `2024-01-15` is ambiguous: it could mean a point in time, or it could represent the whole day as a period. This matters for: - **Data points**: `2024-01-31$ data monthly:close balance` — the closing balance is at the *end* of the day - **Period boundaries**: `2024-01-01^ data quarterly:report start` — report starts at *beginning* of the day - **Transactions**: `2024-12-31$T23:59:59 * Year-end close` — explicitly end-of-period Most systems handle this by convention or context. Making it explicit in the syntax removes ambiguity. ### Syntax Borrowed from regex anchor semantics (`^` = start, `$` = end), which are universally understood by developers. This appears to be novel — no other PTA format or date standard uses single-character period anchors on dates. ### ABNF change ```abnf ; Current datetime = date ["T" time timezone] ; Proposed datetime = date ["T" time [fractional] [timezone]] [period_anchor] period_anchor = "^" / "$" ``` ### Examples ```goluca 2024-01-15^ data quarterly:report start ; start of Jan 15 2024-01-31$ data monthly:close balance ; end of Jan 31 2024-12-31T23:59:59$ * Year-end close ; end of period with full datetime 2024-01-15 * Normal transaction ; point in time (unchanged) ``` ### Implementation Already implemented in tree-sitter-goluca on branch `task/WTfix` with passing tests. ### Documentation to update - `docs/goluca.md` — proposed ABNF, datetime section, characteristics table - `docs/goluca-datetime.md` — period anchor semantics and examples --- *Migrated from Codeberg: originally [#1](https://codeberg.org/hum3/plain-text-accounting-formats/issues/1), opened 2026-03-15.*
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hum3/plain-text-accounting-formats#1
No description provided.