samdark / sitemap

Sitemap and sitemap index builder
BSD 3-Clause "New" or "Revised" License
534 stars 86 forks source link

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

Open ZhangChengLin opened 3 years ago

ZhangChengLin commented 3 years ago

https://github.com/samdark/sitemap/blob/17dc5602e817d7f16b03c476569fb38e2de48156/Sitemap.php#L259 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.

ZhangChengLin commented 3 years ago

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

samdark commented 3 years ago

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

ZhangChengLin commented 3 years ago

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?

samdark commented 3 years ago

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?