j0k3r / graby

Graby helps you extract article content from web pages
MIT License
365 stars 74 forks source link

Convert date to a known format #216

Closed j0k3r closed 5 years ago

j0k3r commented 5 years ago

Instead of just validating the date is ok when parsing it, just convert it to the W3C format

jtojnar commented 5 years ago

Why not just make validateDate return ?DateTime?

j0k3r commented 5 years ago

@jtojnar because it'll break compatibility with current date return. Today we return a plain text which is a valid date according to parse_date function. Now it'll return a formatted date instead but it'll still be a string.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.005%) to 96.52% when pulling d1dbce168be388336257bc2999a02b559d7a9b1c on feature/convert-date into 497f073b792532e42b602ad4d1eb87a6b1f8a322 on master.

tcitworld commented 5 years ago

DateTimeInterface ? Available since PHP 7.2 ? Looks odd.

j0k3r commented 5 years ago

Nope, it's only the constant that are moved to DateTimeInterface in PHP 7.2, before they were defined in DateTime:

7.2.0 | The class constants of DateTime are now defined on DateTimeInterface.