samdark/sitemap

lastmod requires the output format to be Y-m-d

Opened this issue · 4 comments

public function addItem($location, $lastModified = null, $changeFrequency = null, $priority = null)

https://github.com/samdark/sitemap/blob/master/Sitemap.php#L305
https://github.com/samdark/sitemap/blob/master/Sitemap.php#L354

Can the output format of the lastmod tag support Y-m-d
For example, if it is not an integer format parameter, let him use it directly as a string.

If $lastModified is not in integer format but in string format, there is no need to format it.

Currently it assumes UNIX timestamp only but yeah, could be expanded to support cutom format. That adds a possibility to generate incorrect sitemap though...

Currently it assumes UNIX timestamp only but yeah, could be expanded to support cutom format. That adds a possibility to generate incorrect sitemap though...

Something wrong?
why?

It is not wrong per se. Just need to add validation if you're going to accept strings as well. Want to make a pull request?