shaarli / netscape-bookmark-parser

PHP library to parse Netscape bookmark files
https://packagist.org/packages/shaarli/netscape-bookmark-parser
MIT License
22 stars 10 forks source link

Normalize dates to Unix timestamps in _seconds_ #45

Closed virtualtam closed 6 years ago

virtualtam commented 6 years ago

TL;DR: Always use units when expressing data. Units are good.

Relates to shaarli/Shaarli#1227

Although most bookmarking services return dates formatted as a Unix epoch (seconds elapsed since 1970-01-01 00:00:00) or human-readable strings, some services return microtime epochs (microseconds elapsed since 1970-01-01 00:00:00.000000) WITHOUT using a delimiter for the microseconds part...

This PR adds some guesswork to the date parser so results fall within a resonable range, e.g.:

now - 30 years < parsed date < now + 30 years

This is likely to raise issues in the distant future!

See: