Skip to content

Releases: markusmobius/go-htmldate

Go-HtmlDate v1.10.1

Choose a tag to compare

@markusmobius markusmobius released this 14 Sep 17:15

Go-HtmlDate v1.10.1

Go-HtmlDate aims to mirror the date-selection algorithm of Python htmldate. Python is the behavioral reference: different selected dates under equivalent inputs and settings are bugs, not intentional Go-specific behavior. This release follows Python htmldate 1.10.0 at b895282, with Python dateparser 1.4.3, while remaining native Go with no runtime Python dependency.

Changes Since v1.10.0

  • Updated Go-DateParser from v1.4.3 to v1.4.7 and adopted shared Go-Dateutil v2.9.1 for parsing, Unicode helpers and CPython-compatible ISO/timestamp handling.
  • Added read-only DOM pruning that avoids full-tree copies while preserving caller-owned documents and surrounding text.
  • Matched Python's JSON/script precedence, attribute order and HTML repair; corrected ISO-week and compact-date handling, Unicode digit gates and incomplete-date defaults.
  • Corrected timezone-aware bounds and local Unix-reference dates. The default maximum date now follows the current local day on each call.
  • Retained the public Go API, CLI and optional time/timezone extraction.

Python Compatibility

All 9,614 independently generated Python reference cases agree. The 1,000-page saved corpus produces 4,000/4,000 matching dates across publication/last-modified and fast/extensive modes. These tests establish agreement on the tested inputs, not proof for arbitrary pages. Time and timezone extraction remain Go extensions tested separately.

Performance

Median extraction time per 1,000 pre-parsed pages, measured on 2026-09-14 with 500 samples per implementation/mode, eight untimed warmups and 4,000 fully interleaved timed passes. This isolates the pruning improvement within v1.10.1: the baseline is the pre-pruning v1.10.1 implementation, not the v1.10.0 release.

Mode Before pruning, ms/1,000 pages v1.10.1 with pruning, ms/1,000 pages Before / After Fewer Allocated Bytes
Publication, fast 366.38 243.95 1.50x 60.39%
Publication, extensive 990.28 807.81 1.23x 44.29%
Last modified, fast 400.35 253.05 1.58x 60.89%
Last modified, extensive 1,022.69 847.58 1.21x 44.31%

AMD Ryzen AI 7 PRO 350, Linux/WSL2, Go 1.27.1, one extraction caller pinned to CPU 2, default garbage collection and CGO disabled. Parsing, file loading, network access, result formatting and validation are outside the timer. Both implementations use identical normalized inputs, UTC and fixed date bounds/reference time. All output hashes matched. Ratios divide the two medians; allocated bytes are per pass, not peak memory. Results are corpus- and environment-dependent, not guaranteed production speedups.

Benchmark report | Additional version comparison and methodology

Installation

Requires Go 1.26.0 or newer. Linux and Windows CI passed for the release commit.

go get github.com/markusmobius/go-htmldate@v1.10.1
go install github.com/markusmobius/go-htmldate/cmd/go-htmldate@v1.10.1

Full changes since v1.10.0

v1.10.0

Choose a tag to compare

@markusmobius markusmobius released this 10 Sep 23:27

Go-HtmlDate v1.10.0

This release tracks the applicable Python htmldate changes through v1.10.0 (b895282), with all six commits after the previous v1.9.3 baseline accounted for in the upstream commit audit. Go-specific time and timezone extraction and the documented differences from Python are preserved.

NOTE: The upgrade from 1.9.3 to 1.10.0 was performed with the help of GPT-6-Astra.

Upgrade

Requires Go 1.26.0 or newer; the recommended development toolchain is Go 1.27.1.

go get github.com/markusmobius/go-htmldate@v1.10.0
go mod tidy

To install the CLI:

go install github.com/markusmobius/go-htmldate/cmd/go-htmldate@v1.10.0

The release is installable without merging the synchronization branch. The existing master branch remains unchanged.

Changes

  • Synchronize applicable extraction behavior with Python htmldate v1.10.0, including year plausibility checks and normalized candidate selection.
  • Defer DOM cloning until mutation is necessary, preserving caller-owned documents while avoiding redundant copies.
  • Recalculate the default maximum date for each extraction: the end of the current local calendar day, represented in UTC. This replaces the previous default of one year after process startup. Set MaxDate explicitly to accept future dates.
  • Refresh dependencies, including go-dateparser v1.4.3, and align the supported Go toolchains.
  • Add fixed-bound regression tests, including 24 checks covering six known Python deviations across all four extraction modes.
  • Apply 42 upstream evaluation-label corrections and add a reproducible offline four-way Go/Python comparison with dependency-version checks.
  • Correct README, API, CLI, and example documentation and record paired performance measurements. No additional generated regex matchers or scanner optimizations were introduced.

Compatibility and Validation

The full Go suite passes on Go 1.26.0 and Go 1.27.1. All 4,000 saved-page Go outputs remain unchanged on the 1,000-page comparison corpus. The published module was downloaded, its tagged CLI installed outside the checkout, and the installed CLI passed a saved-page smoke test.

With matching Python dateparser 1.4.3, Go/Python agreement is 994/1,000 pages in each original-date mode and 998/1,000 in each modified-date mode. This is not complete behavioral parity, and modified-date agreement is not an accuracy score. The known deviations document the exact causes and retained limitations. The reference Python suite's two known failures remain disclosed and were not hidden by changing upstream tests.

See the README for usage, comparison results, and paired performance measurements.

v1.9.3

Choose a tag to compare

@RadhiFadlillah RadhiFadlillah released this 02 May 01:46

Catch up to Python's htmldate v1.9.3

  • Add more heuristics
  • Add some more tests
  • Update re2go to v4.1
  • Upgrade dependencies, especially go-dateparser

v1.9.1

Choose a tag to compare

@RadhiFadlillah RadhiFadlillah released this 10 Oct 10:22
f291a05

Catch up to Python' htmldate v1.9.1 by @RadhiFadlillah in #6

v1.8.2

Choose a tag to compare

@RadhiFadlillah RadhiFadlillah released this 20 Sep 03:00
085c30a

What's Changed

  • Compiling several regexes ahead of time using re2go for better performance by @RadhiFadlillah in #5

Full Changelog: v1.8.1...v1.8.2

v1.8.1

Choose a tag to compare

@RadhiFadlillah RadhiFadlillah released this 14 Jun 01:10

Catch up to the original htmldate v1.8.1

Fix compilation under Windows with MingW-w64

Choose a tag to compare

@markusmobius markusmobius released this 26 Jun 05:59
v1.2.2

added back original go-re2 after fixes to windows compile