Support negative Unix timestamps that represent dates before 1970

Created on 29 November 2024, 20 days ago

Problem/Motivation

I've faced an issue with the "XML sitemap" generation. The issue appeared because some of the content items have negative timestamps that Drupal supports in the Core.

It would be great if this module supported negative Unix timestamps representing dates before 1970. For example, a timestamp of -620139600 corresponds to Monday, May 8, 1950, 12:00 PM UTC.

Steps to reproduce

- Create node(s) with negative timestamp values in the node_field_data.changed database table.
- Try to rebuild the Sitemap from the admin panel or use the drush command.
- See MySQL error: "Numeric value out of range:{X} Out of range value for column 'lastmod' at row {Y}"

Proposed resolution

The proposed solution is to remove the "unsigned" attribute from the "xmlsitemap.lastmod" database column.
We may change the xmlsitemap_schema to provide this possibility for the new module installation and also provide an additional update_N function to fix the issue on the existing module installations.

Data model changes

The xmlsitemap.lastmod database column could be updated to the int type allowing null and negative values.

πŸ› Bug report
Status

Active

Version

1.0

Component

xmlsitemap.module

Created by

πŸ‡©πŸ‡ͺGermany kufliievskyi Germany, Bayern

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024