freerange/jam-coop

Problem setting date of album release

Closed this issue · 2 comments

A couple of artists have reported seeing the following error when editing an album

Screenshot 2024-02-13 at 20 33 59

It looks like the release date has to be set earlier than 21st January 2024. I'm not sure what's causing the issue - the time on the server looks to be set correctly.

  • I notice I am able to set a later released_on date through the rails console and the model successfully saves with no validation errors
  • I can't seem to reproduce this bug locally
  • The date in the error message 2024-01-21 matches the last deployment date of the web server in render:
Screenshot 2024-02-13 at 20 59 11

This makes me wonder whether the validation line in app/models/album.rb is somehow caching or closing over the value of Time.zone.today the first time it is called or the server is booted.

Does that sound remotely plausible @floehopper?

I restarted the server and was able to set the released_on date to today (and other dates later than 2024-01-21). So I think it's plausible that the released_on validation code in album.rb is executed when the application starts and evaluates Time.zone.today at that time. I'll see if there's a way to make it dynamically evaluate the validation code each time it is used.