Skip to content

Compare content schedule dates against UTC - #1251

Merged
KevinJump merged 2 commits into
v17/mainfrom
feature/001-v17-content-schedule-dates
Nov 19, 2026
Merged

KevinJump merged 2 commits into
v17/mainfrom
feature/001-v17-content-schedule-dates

Conversation

@KevinJump

Copy link
Copy Markdown
Member

Summary

  • Umbraco 17 stores content schedule dates in UTC; uSync compared them against DateTime.Now, so schedules were mishandled on servers not running on UTC.
  • ContentScheduleExtensions.CalculateCultureState (Release and Expire) and the past-schedule skip in ContentSerializer.DeserializeSchedulesAsync now compare against DateTime.UtcNow.
  • Schedule dates read from a uSync file come back as DateTimeKind.Utc (DateTime.SpecifyKind, no conversion).
  • The export format is unchanged (ToString("s"), no offset), so existing files don't show as changed.
  • Regression tests force the process's local timezone to UTC+11 / UTC-5 and restore it afterwards (unit tests for the culture state, an integration test for import).

Closes #1235

🤖 Generated with Claude Code

KevinJump and others added 2 commits November 19, 2026 20:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the release/17.6.3 uSync 17.6.3 release label Nov 19, 2026
@KevinJump
KevinJump marked this pull request as ready for review November 19, 2026 20:20
@KevinJump

Copy link
Copy Markdown
Member Author

Ready for review.

Summary

  • Content schedule dates are now checked against DateTime.UtcNow in the three places that used DateTime.Now: the Release and Expire branches of CalculateCultureState, and the skip-past check on import. Umbraco 17 stores these dates in UTC.
  • Schedule dates read from a uSync file are now marked DateTimeKind.Utc. Only the kind changes; the value is not shifted.
  • The export format is unchanged (ToString("s"), no Z), so existing files won't show as changed. Intake left the format change out on purpose.
  • New regression tests force the local timezone to UTC+11 and UTC-5, and put it back afterwards. They fail without the fix and pass with it. The gate passed with 237/237 tests and the code review passed.

Why

This is a small, contained bug fix that matches intake's Scope exactly: two production files with a few changed lines between them, plus three new test files. No serialized format, public API, dependency or packaging changes. I checked that BuildScheduleDto in Umbraco 17's ContentBaseFactory writes ContentSchedule.Date straight into the DTO, so marking the date as UTC doesn't change what gets stored. Treating v13-era local dates as UTC was a deliberate decision in intake. It only moves where the "in the past" cutoff falls, not the stored value, so a person doesn't need to decide anything.

Acceptance criteria

  1. No DateTime.Now in ContentScheduleExtensions.cs, and both checks use UtcNow: met. I confirmed it in the diff, and a grep of uSync.Core finds no DateTime.Now left.
  2. In ContentSerializer.cs, the skip uses UtcNow and GetContentScheduleFromNode uses SpecifyKind(..., Utc): met (diff lines 350 and 414).
  3. SerializeScheduleAsync is unchanged: met. The diff touches only the two hunks above.
  4. At UTC+11, a future Release gives Saved: met. FutureRelease_LocalAheadOfUtc_IsPending passes, and build.md shows it failing with the fix stashed.
  5. At UTC-5, a past Release gives Published and a past Expire gives Unpublished: met. Both tests pass and both failed before the fix.
  6. Import at UTC+11 keeps a future Release: met. Import_FutureRelease_LocalAheadOfUtc_KeepsSchedule passes and failed before the fix.
  7. Each fixture restores the timezone: met. Each [TearDown] asserts that the Id and BaseUtcOffset match the values captured in [SetUp].
  8. The diff covers only the two core files and the new tests: met. git diff --stat shows 5 files: 2 core files and 3 new test files.

Release

patch: "Fixed content schedule dates being compared against server local time instead of UTC, which dropped or mis-stated scheduled publish/unpublish dates on servers not running on UTC (#1235)."

The approver approved this, but medium-risk jobs are merged by a person.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/17.6.3 uSync 17.6.3 release

Development

Successfully merging this pull request may close these issues.

v17: content schedule dates compared against local time instead of UTC

1 participant