diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dce3796..3dd7aa0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -121,13 +121,13 @@ jobs: - name: Initialize CodeQL if: env.SKIP != 'true' - uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4 + uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} - name: Analyze if: env.SKIP != 'true' - uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4 + uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e09f7fb..72d570a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -310,7 +310,7 @@ jobs: # roughly 600 of windows-latest's 694. test.yml has cached since it was written; the # build matrix simply never got one. - name: Cache Rust dependencies - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + uses: swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 with: workspaces: src-tauri -> target diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a09f4ae..647515c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -172,7 +172,7 @@ jobs: # roughly daily. A `Cargo.lock` or rustc change between releases means develop runs cold # until the next one - the honest cost of three entries instead of nine. - name: Cache Rust dependencies - uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + uses: swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 with: workspaces: src-tauri -> target save-if: ${{ github.ref == 'refs/heads/main' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd27cd..2eccd69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ popover, not for the person who wrote the commit. ## [Unreleased] +## [1.11.5] - 2026-11-05 + +### Fixed + +- **Importing an older export no longer swaps day and month.** Archives from before the export + format changed carry dates the way the exporting computer wrote them, and on a computer set + to a day-first format such as British English, every stash created up to the 12th of a month + came back with day and month swapped - 12 March became 3 December. Stashes already imported + keep the dates they were given + ## [1.11.4] - 2026-11-05 ### Added diff --git a/package.json b/package.json index 96930c4..5ab999a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stashpad", - "version": "1.11.4", + "version": "1.11.5", "description": "The staging area for your AI context.", "author": { "name": "Nico Wiedemann", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index dee2b47..466d8b4 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5557,7 +5557,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stashpad" -version = "1.11.4" +version = "1.11.5" dependencies = [ "active-win-pos-rs", "aes-gcm", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7b8fd87..50cd097 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stashpad" -version = "1.11.4" +version = "1.11.5" description = "The staging area for your AI context." authors = ["Nico Wiedemann "] repository = "https://github.com/EarMaster/stashpad" diff --git a/src-tauri/src/transfer.rs b/src-tauri/src/transfer.rs index 2c347db..06c490f 100644 --- a/src-tauri/src/transfer.rs +++ b/src-tauri/src/transfer.rs @@ -142,17 +142,24 @@ fn parse_heading_date(raw: &str) -> Option { /// The `toLocaleString()` forms older exports used, which no ISO parser reads: /// -/// * `8/20/2026, 10:14:32 AM` and `8/20/2026, 10:14:32` - en-US, month first +/// * `8/20/2026, 10:14:32 AM` - en-US, month first /// * `20.8.2026, 10:14:32` and `20.8.2026 10:14:32` - de-DE /// * `20/8/2026, 10:14:32` and `20/8/2026 10:14:32` - en-GB and similar, day first +/// * `20/8/2026, 10:14:32 am` - en-AU, en-IN and similar, day first /// -/// A slash date is tried month first, as en-US is far the more common, and read day first -/// only when that cannot be a date - the same order the formats were tried in before. +/// **A slash date is month first only beside an upper-case `AM`/`PM`.** en-US +/// `toLocaleString()` always writes one, and the day-first slash locales write either a +/// 24-hour clock or a lower-case `am`/`pm`. This used to try month first for every slash +/// date and fall back to day first only when month first was impossible, so an en-GB +/// archive's `12/03/2026` - 12 March - came back as 3 December, and every date up to the +/// 12th of a month was silently swapped on import. The other order is still tried when the +/// preferred one cannot be a date, so a stray `8/20/2026, 22:14:32` reads as 20 August. fn parse_locale_heading(text: &str) -> Option { let (date, rest) = text.split_once([',', ' '])?; let mut clock = rest.trim_start_matches([',', ' ']).split(' '); let hms = clock.next()?; let meridiem = clock.next(); + let month_first = matches!(meridiem, Some("AM" | "PM")); if clock.next().is_some() { return None; } @@ -196,7 +203,8 @@ fn parse_locale_heading(text: &str) -> Option { ) }; match separator { - '/' => at(a, b).or_else(|| at(b, a)), + '/' if month_first => at(a, b).or_else(|| at(b, a)), + '/' => at(b, a).or_else(|| at(a, b)), _ => at(b, a), } } @@ -1425,10 +1433,14 @@ old ("8/20/2026, 12:05:00 PM", "2026-08-20 12:05:00"), ("8/20/2026, 22:14:32", "2026-08-20 22:14:32"), ("20.08.2026 10:14:32", "2026-08-20 10:14:32"), - // Day first only when month first cannot be a date. ("20/8/2026, 10:14:32", "2026-08-20 10:14:32"), ("20/8/2026 10:14:32", "2026-08-20 10:14:32"), - ("3/4/2026, 10:14:32", "2026-03-04 10:14:32"), + // Month first only beside an upper-case meridiem, which only en-US writes. + ("3/4/2026, 10:14:32 AM", "2026-03-04 10:14:32"), + // Day first otherwise: en-GB's 24-hour clock, en-AU's lower-case am/pm. + ("3/4/2026, 10:14:32", "2026-04-03 10:14:32"), + ("12/03/2026, 09:25:39", "2026-03-12 09:25:39"), + ("3/4/2026, 10:14:32 pm", "2026-04-03 22:14:32"), ("2026-08-20T10:14:32", "2026-08-20 10:14:32"), ("2026-08-20", "2026-08-20 00:00:00"), ("2026-08-20T10:14:32+02:00", "2026-08-20 08:14:32"), diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 648dbc4..f93ad44 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "stashpad", - "version": "1.11.4", + "version": "1.11.5", "identifier": "org.stashpad", "build": { "frontendDist": "../dist",