Skip to content

Read date text in arithmetic using the workbook Region - #3445

Draft
addibbi wants to merge 61 commits into
storytold:mainfrom
addibbi:fix/regional-arithmetic-dates
Draft

addibbi wants to merge 61 commits into
storytold:mainfrom
addibbi:fix/regional-arithmetic-dates

Conversation

@addibbi

@addibbi addibbi commented Nov 5, 2026 •

Copy link
Copy Markdown

Reproduction

With de-DE selected, put the text 31.01.2021 in A1 and enter =A1+0 in B1. The Excel comparison by @KNUFFIXX reports 44227 in Excel for Windows and #VALUE! in GridCraft. The synthetic regression reproduces that error on the parent branch and checks that B1 now returns 44227.

Scope

Dependency

Draft follow-up to #2429 at fddc70048e4e9644976262de7f311cb5c3f3504c, which depends on #1886 and the regional data from #3048. The upstream PR targets main. Review the incremental diff against #2429 for this change alone.

Validation

The generated tests cover the reported de-DE case, both date systems, unary and binary arithmetic, array results, invalid date text, canonical numeric text and recalculation after a Region change. The Excel comparison is the published de-DE observation above.

Head 5e24bbf9c06650e16813db8ce1c9f6cbe3410f66 includes main 00e8f4fae06d6db324ff551080edf9e0453ccd6e. Independent local Linux arm64 CI passed on the published tree. 10/10 gates, 4,157 tests passed, 0 failed and 5 ignored. All 9 selected regression checks passed.

quantmind-br and others added 30 commits October 15, 2026 10:30
Adds the data model for Excel-style regional formats, with no behaviour
change: nothing reads it yet.

- core: region.rs with `Region` (separators, grouping, date order, short and
  long date and time codes, month and day names, AM/PM words, currency) and
  the 15 regions en-US, en-GB, en-IN, es-ES, de-DE, fr-FR, it-IT, pt-BR,
  pt-PT, ru-RU, cs-CZ, ja-JP, ko-KR, zh-CN, zh-TW. Values follow Unicode CLDR;
  the deliberate departures (four-digit short-date year, Windows grouping
  spaces) are listed in the module doc. `all`, `find` (strict tag),
  `lookup` (system or browser tag, best effort) and `default_region` (en-US)
  select one; `EN_US` reproduces today's behaviour exactly. Unit tests check
  the tables and the lookups.
- model: `Workbook::region`, a `#[serde(skip)]` runtime field that is never
  saved and defaults to en-US. It is here so that the following changes can
  be reviewed independently of each other.

The region is independent of the interface language and of the formula
language. Builds on this, in order: typed input (core `parse_input_in`),
display (numfmt and engine display), the engine session and `app.region`
command, then the Options UI and the app defaults.
…eriods)

- lookup stops at an extension or private-use singleton:
  en-GB-u-ca-gregory is en-GB (ca was read as Canada) and
  zh-Hant-u-nu-latn is zh-TW.
- For Chinese an explicit territory wins over the script, so
  zh-Hant-CN is China's conventions, consistent with zh-Hans-TW.
- In regions whose month abbreviations end in a period (ru-RU, fr-FR),
  month_from_name accepts any abbreviation typed with one (мар., июн.);
  elsewhere a period stays outside the name, so en-US is unchanged.
Reads what a person types in a region: `parse_input_in(s, sys, &Region)`.

- Numbers: the region's decimal and group separators (`1.234,56`), Indian
  grouping, space-like group characters, percent and scientific notation.
  Where the decimal is not a point, a point is only a group separator.
- Currency: the region's symbol, before or after the amount (`R$ 3,50`,
  `1.234,50 €`); the automatic number format is the region's currency format.
- Dates: day, month, year order per region (`25/09/2026`, `25.09.2026`,
  `2026/9/25`), two-digit years, ISO, month/year, and local month names with
  connector words (`25 de septiembre de 2026`, `25. září 2026`). The returned
  format codes stay canonical (`m/d/yyyy` is the system short date).
- Times: the region's time separator and AM/PM words, including CJK words
  before the time (`午後3:30`).

`parse_input` is now the en-US wrapper around `parse_input_in`, and
`parse_number_text` (worksheet text coercion) stays en-US, so nothing that
exists today changes; the unit tests pin that for a list of en-US inputs and
cover every region, including a no-panic sweep of hostile text.

Nothing calls `parse_input_in` yet. Builds on region-data; the engine
branch (session region, `region` parameter of the typed-input commands)
uses it.
Merge quantmind-br/region-typed-input without rewriting its shared history. This is the dependency baseline for regional DATEVALUE/TIMEVALUE support.

Co-authored-by: Codex 6.1 Sol <noreply@openai.com>
Connect DATEVALUE and TIMEVALUE to Workbook.region through Ctx and parse_input_in. Cover MDY/DMY/YMD, both date systems, regional names and canonical generic coercion.

Co-authored-by: Codex 6.1 Sol <noreply@openai.com>
Load the session region before creating, opening or sampling a workbook. Add validated native and CLI --region flags, apply the same region to the check oracle and round-trip readback, and exercise opening under MDY/DMY/YMD.

Co-authored-by: Codex 6.1 Sol <noreply@openai.com>
Add the shared app.region contract and recalculate all open documents when it changes. Preserve clean/dirty and undo/redo save points, keep input canonical, and cover January pivot recovery with generated Rust fixtures.

Co-authored-by: Codex 6.1 Sol <noreply@openai.com>
A fresh sample-building Session and Workbook already use en-US, and add_document applies the session region. Remove the duplicate assignment suggested in the technical feedback on storytold#1524; keep the pre-open region application in the command paths.

Co-authored-by: Codex 6.1 Sol <noreply@openai.com>
Keep csvAsText import and apply Region before the opening-time recalculation.
Cover text-only CSV identifiers and regional DATEVALUE, and retain both
localization histories. Preserve the existing unmerged regional dependencies.

Use a zero-sized non-Linux desktop-theme handle for strict macOS Clippy;
the Linux portal connection and theme behavior are unchanged.

Validation on this PR alone: cargo xtask ci, all eight gates passed; 1697 tests passed, 0 failed, 1 ignored.
Integrate current main into the storytold#1886 dependency branch and extend
regional date interpretation to implicit date-serial arguments. Keep
canonical numeric-text coercion and cover both date systems, holiday
arguments, region changes and synthetic XLSX round trips.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
The Swiss regions group digits with an apostrophe (CLDR 48) and accept the
typographic one glibc uses; lookup maps CH and LI tags to them. Dutch
(Netherlands) follows CLDR 48.
Preserve the storytold#1886 dependency while combining the regional setting
with the upstream status-bar preference and commands. Keep regional
date coercion, numeric serial handling and startup behavior intact.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Preserve Region parsing, DATEVALUE/TIMEVALUE and startup recalculation
while retaining upstream parser hardening, file loading and UI preferences.
Keep the unmerged regional dependency history.

Merge main 17b9f6f.

Validation before commit: separate cargo --offline --locked xtask ci, 10/10 gates;
2441 tests passed, 0 failed, 1 pre-existing ignored.
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Merge main f6b0cec while retaining the regional parser history,
DATEVALUE/TIMEVALUE behavior and session-level Region configuration.
Preserve shared workbook windows and opaque native control-token values.
Add generated cache-attachment, shared-window/history and argument regressions.

Validation before commit: separate cargo --offline --locked xtask ci,
10/10 gates; 2568 tests passed, zero failed,
1 pre-existing ignored; all 43 selected checks passed.
Pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Merge c17393c, including main f6b0cec.
Preserve the contribution's existing behavior, regression coverage and safeguards.

Validation before commit: separate cargo --offline --locked xtask ci,
10/10 gates; 2574 passed, 0 failed, 1 pre-existing ignored.
All 51 selected checks passed on tree 704d704.
CI-pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
… main

Merge 45f5ab1, including main 45f5ab1.
Separate the per-launch Region override from saved preferences; preserve current Region, grouped rollback savepoints and clean/dirty semantics. Document changed helpers and cover the fixes with fictional regressions.

Validation before commit: separate cargo --offline --locked xtask ci,
10/10 gates; 2581 passed, 0 failed, 1 pre-existing ignored.
All 56 selected checks passed on tree ce98eef.
CI-pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Merge edf088d, including main 45f5ab1.
Inherit the corrected regional integration from storytold#1886 while preserving numeric-serial coercion and this draft follow-up.

Validation before commit: separate cargo --offline --locked xtask ci,
10/10 gates; 2587 passed, 0 failed, 1 pre-existing ignored.
All 64 selected checks passed on tree 2cf6fe9.
CI-pinned craft-fonts b076417b5880bd4154bd22f00695b1d28c6bea83, required mode.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Respond to the reported Excel COM observations using synthetic data only.
Reject outer whitespace only on implicit date/time text; keep numeric serial rules.
Expose the remaining canonical VALUE/arithmetic boundary rather than claiming regional parity.
Three whitespace regressions failed before the fix and pass afterwards.

Separate local cargo --offline --locked xtask ci before commit/push:
10/10 gates; 2591 passed, 0 failed, 1 pre-existing ignored.
All 68 selected tests passed on tree 22becb6.
CI-pinned required fonts verified; no GitHub CI execution is claimed.
Andrea Di Benedetto and others added 10 commits November 2, 2026 13:13
Use the workbook date system and Region for date and time text in
arithmetic operators. Keep canonical number syntax and VALUE coercion.
Cover the de-DE report, array arithmetic, both calendars and runtime
Region changes with generated data.

Local Linux arm64 CI on the exact staged tree passed 10/10 gates
and 3570 tests, with no failures and one pre-existing ignored test.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Keep the upstream and regional entries in ROADMAP.md.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3607 tests passed, 0 failed and 1 ignored.
Integrate the verified parent 49facc2 and retain this draft follow-up.
Keep the upstream and regional entries in ROADMAP.md.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3617 tests passed, 0 failed and 1 ignored.
Integrate the verified parent 621f665 and retain this draft follow-up.
Keep the upstream and regional entries in ROADMAP.md.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3618 tests passed, 0 failed and 1 ignored.
Preserve the upstream Arabic and regional documentation in localization-parity.md.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3723 tests passed, 0 failed and 4 ignored.
Preserve the upstream and regional entries in the localization documentation.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3733 tests passed, 0 failed and 4 ignored.
Preserve the upstream and regional entries in the localization documentation.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3734 tests passed, 0 failed and 4 ignored.
Use the Region data merged in storytold#3048 and retain the regional input and rollback behavior.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3759 tests passed, 0 failed and 4 ignored.
Preserve the follow-up on the tested regional parent and retain the upstream localization history.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3769 tests passed, 0 failed and 4 ignored.
Preserve the follow-up on the tested regional parent and retain the upstream localization history.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3770 tests passed, 0 failed and 4 ignored.
Preserve both the regional option and the upstream sandbox command in the CLI help.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3867 tests passed, 0 failed and 4 ignored.
Keep the follow-up on the tested regional parent after the CLI help realignment.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3878 tests passed, 0 failed and 4 ignored.
Keep the follow-up on the tested regional parent after the CLI help realignment.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3877 tests passed, 0 failed and 4 ignored.
Keep the arithmetic and GCD/LCM notes in the function parity checklist.

Linux arm64 CI: 10/10 gates passed, 3955 tests passed, 0 failed, 4 ignored.
Preserve both the regional entries and the upstream Arabic PDF updates in the localization checklist.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3985 tests passed, 0 failed and 4 ignored.
Keep the follow-up on the tested regional parent and retain both sets of documentation entries.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3995 tests passed, 0 failed and 4 ignored.
Keep the follow-up on the tested regional parent and retain both sets of documentation entries.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 3996 tests passed, 0 failed and 4 ignored.
Preserve both the regional entries and the upstream localization changes in the localization checklist.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 4146 tests passed, 0 failed and 5 ignored.
Keep the follow-up on the tested regional parent and retain both sets of documentation entries.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 4156 tests passed, 0 failed and 5 ignored.
Keep the follow-up on the tested regional parent and retain both sets of documentation entries.

Local Linux arm64 CI passed on the exact tree. 10/10 gates, 4157 tests passed, 0 failed and 5 ignored.

This branch has not been deployed

No deployments
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