The script may be configured to run with a timezone other than UTC. This means the strings cannot be compared until they are normalised to UTC as the same actual hour may otherwise be represented by different values.
For example:
// This:
item.snippet.publishedAt > lastTimestamp
// Becomes:
"2024-04-16T11:36:30Z" > "2024-04-16T21:23:36+10:00"
// Which is false even through the date on the left comes after the date on the right.
The script may be configured to run with a timezone other than UTC. This means the strings cannot be compared until they are normalised to UTC as the same actual hour may otherwise be represented by different values.
For example:
This incorrect comparison is done here: https://github.com/Elijas/auto-youtube-subscription-playlist-2/blob/25e6783932ef0ef4874422327fc0a6402ffac428/sheetScript.gs#L422 And here: https://github.com/Elijas/auto-youtube-subscription-playlist-2/blob/25e6783932ef0ef4874422327fc0a6402ffac428/sheetScript.gs#L526 Whereas a correct comparison is done here: https://github.com/Elijas/auto-youtube-subscription-playlist-2/blob/25e6783932ef0ef4874422327fc0a6402ffac428/sheetScript.gs#L378