Files
wordcraft/crates/pdf/src
36e7ee7ade #6851: tracked changes are dated in local time, as Word reads w:date (#6876)
* #6851: date tracked changes in local time, as Word reads w:date

Word writes w:date as the local wall-clock time with a Z it doesn't mean,
and reads it back the same way. WordCraft stamped new tracked changes with
UTC, so Word showed them shifted by the author's offset from UTC.

Typing, deletions, moves, formatting changes and Compare's result now take
cmd::revision_date(): the local time from the existing local_offset_secs
helper, written with a Z. Comments keep their w16cex:dateUtc and are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #6851: the local-time test accepts any second between its samples

Review on #6876: the tracked change may be stamped a second after the
first sample and before the second, so compare against the interval, in
order, rather than its two ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #6851: check the stamp against each second's own local time

Review on #6876: across a backward daylight-saving change the local times
of the two samples no longer bound the stamp. Sample the UTC clock instead
and accept the local time of any second between the samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* #6851: the local-time test pins its zone and covers every revision

A test-only, per-thread zone for revision_date() lets tracked_changes_carry_the_local_time
stamp at UTC+8:45 on any runner. On CI's UTC runner a UTC stamp was also the local one, so
switching a call site back to now_iso() passed. The test now makes a revision through each
place that dates one: typing, a paragraph tool, formatting, AutoFormat's border line, a tracked
cut pasted as a move, and Compare.

* #6851: keep tracked change dates in UTC; convert w:date at the DOCX boundary

The document keeps the UTC instant, so revision grouping tells apart two
edits an hour apart in the repeated hour as daylight saving time ends.
Saving .docx/.docm/.dotx/.dotm or Word XML writes w:date as local
wall-clock time with a Z, as Word writes and reads it; opening them reads
it back to UTC. Tests set the clock and zone per thread.

* Dependencies: take craft-libs main at 8a5b916541

8a5b916541 is craft-libs#3220: craft-docx reads and writes w16du:dateUtc
on tracked changes and keeps it in the shared model's Revision, so two
changes with one local w:date stay two. #6876 (#6851) builds on it.

The egui and winit forks craft-libs builds with are unchanged
(b9770908e0, a517b3846e). Cargo.lock: the craft-libs sources move to the
new rev and craft-control-protocol, a craft-libs crate, is added.

* #6851: tracked changes keep their UTC time beside w:date

A revision now has date_utc, as comments do, read from and written to
w16du:dateUtc by craft-docx. Changes made here are stamped with both in
UTC, grouped by the UTC instant, and a Word save writes their w:date in
local wall-clock time, as Word does, with dateUtc beside it. A change read
from a file is written as read: open no longer guesses the zone a w:date
without dateUtc was written in. review.changes reports the UTC time when
it is known.

Two edits in the repeated hour reopen as two changes, and Reject on the
second leaves the first pending.

* Dependencies: section metadata test expects w16du in mc:Ignorable

craft-libs#3220 declares the w16du namespace in body parts and lists it
in mc:Ignorable, so readers that don't know it ignore it.

* #6851: rustfmt the test revisions

* #6851: docs describe dateUtc and dates written as read

* #6851: date a change in local time when it is made, not when it is saved

The save treated a revision whose w:date equals its dateUtc as made here
and moved its w:date to local time. A file written in UTC has the two
equal too, so saving it in another zone moved the time Word shows for an
edit nobody touched.

A change made here now gets its local w:date when it is made
(cmd::made_revision), with its UTC time in date_utc, and saves write
every revision as it is. Nothing is inferred from the dates.

* #6851: OpenDocument dates a tracked change by its UTC time

A change made here keeps Word's local wall-clock time in `date`, which
the ODF writer wrote verbatim as dc:date, an instant, so an edit at
08:33 UTC at UTC+8 was exported as 16:33 UTC. The ODT, OTT and Flat ODF
exports now date a change by its UTC time where it is known, and by
`date` otherwise.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Martin Ball <98639962+benandez@users.noreply.github.com>
2026-12-01 10:54:25 +01:00
..
2026-11-14 12:11:53 -08:00
2026-11-14 12:11:53 -08:00