Skip to content

Use UTC for created_at in order to prevent diff noise when running models:update from a different timezone#631

Merged
crmne merged 5 commits into
crmne:mainfrom
radanskoric:use-utc-model-timestamps
Feb 27, 2026
Merged

Use UTC for created_at in order to prevent diff noise when running models:update from a different timezone#631
crmne merged 5 commits into
crmne:mainfrom
radanskoric:use-utc-model-timestamps

Conversation

@radanskoric

Copy link
Copy Markdown
Contributor

What this does

The PR converts models info created_at field to use UTC time.

This will then prevent random diff noise when people from different timezones run the update.

Before, running the models update from a different timezone than the previous updater would change all timestamps to your timezone producing a very noisy diff.

The PR is composed of 4 commits that build on each other. They're separated for easier review with more details in commit descriptions:

  1. Add a spec for RubyLLM::Model::Info
  2. Normalise model creation time to UTC
  3. Parse release date as UTC midnight
  4. Update models.json to convert created_at to UTC

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
    • [ ] For provider changes: Re-recorded VCR cassettes with bundle exec rake vcr:record[provider_name]
    • All tests pass: bundle exec rspec
  • [ ] I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

AI-generated code

  • I used AI tools to help write this code (only for the first version of the spec)
  • I have reviewed and understand all generated code (required if above is checked)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

Comment thread lib/ruby_llm/models.rb Outdated
Currently the model time is not normalised in UTC.
This means that if someone tries to update models
while being in a different timezone from the previous
updater, all timestamps will be changed, leading
to a lot of noise in the diff.

Normalising to UTC guarantees the same output no
matter which timezone the update is run in.
This is needed to make the parsing independent
of system timezone. Without it, a date is parsed
as midnight in the current system timezone so the
date can change after converting to UTC.

Both release_date and last_updated fields from
models.dev are midnight.

This is also a future proof change because, if
models.dev was to start returning timestamps,
Time.parse will parse the timestamp and ignore
the appended "UTC midnight" string.
Previous commits modified to logic to save created_at as UTC.
This was done to prevent random diff noise when people from
different timezones run the update.

This run is to convert all timestamps to UTC.
@radanskoric
radanskoric force-pushed the use-utc-model-timestamps branch from fb11176 to 97c72f9 Compare February 27, 2026 14:17
@codecov

codecov Bot commented Feb 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.88%. Comparing base (bed3bfb) to head (97c72f9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #631      +/-   ##
==========================================
+ Coverage   80.13%   80.88%   +0.74%     
==========================================
  Files         113      113              
  Lines        5095     5096       +1     
  Branches     1307     1308       +1     
==========================================
+ Hits         4083     4122      +39     
+ Misses       1012      974      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@crmne
crmne merged commit 18c6e13 into crmne:main Feb 27, 2026
@radanskoric
radanskoric deleted the use-utc-model-timestamps branch February 28, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants