Skip to content

Partial and offset dates elsewhere: cloaking-probe recency, page-side dates in lastmod drift, local-time fallback, churn's UTC day #772

Closed

Description

@nc9

Follow-ups from the review of #771 (#758), which made the sitemap lastmod rules read 2024 and 2024-09 as the whole year or month. The same kind of date reading remains elsewhere:

  1. Cloaking probe recency (packages/audit-engine/src/cloaking-probe.ts, the recent-lastmod selection): Date.parse("2026") is 1 January, so a lastmod stamped with the current year is never "recent" (287 days against the default 14), while 2026-10 is.
  2. Page-side dates in crawl/sitemap-lastmod-drift: the page's own date still goes through new Date, so a schema dateModified: "2024" against lastmod 2024-09-10 warns 253 days ahead.
  3. The instant fallback accepts non-W3C shapes at local time: 2024-9, 2024-09-1 and 2024/09 fall through w3cDatePeriod to new Date, which reads them at host-local midnight, so the result depends on the machine's timezone.
  4. crawl/sitemap-lastmod-churn reports the UTC day of an offset datetime: 2024-09-10T23:30:00-05:00 counts as 2024-09-11, a day the sitemap never wrote.
  5. Date-only vs month consistency: against a page date of 2025-01-08T12:00Z, 2024-12-31 reports 8 days behind (warn) while 2024-12 reports 7 (pass). Treating a date-only lastmod as the whole day would make them agree.

Acceptance Criteria

  • The cloaking probe reads a year or year-month lastmod as its period, and measures recency from its end (capped at now).
  • crawl/sitemap-lastmod-drift gives the page date a period too, and measures the gap between the two periods.
  • A lastmod that is not a W3C Datetime is read the same way on every machine (in UTC, or rejected).
  • crawl/sitemap-lastmod-churn counts the day the sitemap wrote, not its UTC conversion.
  • Each case has a rule or engine test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions