This repository was archived by the owner on Nov 10, 2025. It is now read-only.
Use full precision timestamps in JSON responses#790
Merged
Conversation
ec84685 to
2225144
Compare
Currently we store timestamps with microsecond precision (the default and maximum for PostgreSQL), but over the wire we only send milliseconds (the default for Rails). This is fine for most purposes, but as we're migrating data from forms-api to forms-admin at the moment it's helpful to get the full precision so we can easily compare the contents of the two databases without noise from truncated timestamps. This commit uses the ActiveSupport configuration parameter to change the `TimeWithZone#as_json` method to return all 6 digits of precision.
2225144 to
d9c1758
Compare
|
lfdebrux
added a commit
to govuk-forms/forms-admin
that referenced
this pull request
Aug 29, 2025
In forms-api PR govuk-forms/forms-api#790 we increased the precision of timestamps when serializing to the maximum; we should do the same in forms-admin.
SamJamCul
pushed a commit
to govuk-forms/forms-admin
that referenced
this pull request
Aug 29, 2025
In forms-api PR govuk-forms/forms-api#790 we increased the precision of timestamps when serializing to the maximum; we should do the same in forms-admin.
SamJamCul
added a commit
to govuk-forms/forms-admin
that referenced
this pull request
Aug 29, 2025
In forms-api PR govuk-forms/forms-api#790 we increased the precision of timestamps when serializing to the maximum; we should do the same in forms-admin. Co-authored-by: Samuel Culley <samuel.culley@digital.cabinet-office.gov.uk> Co-authored-by: Stephen Daly <stephen.daly@digital.cabinet-office.gov.uk> Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@dsit.gov.uk>
SamJamCul
added a commit
to govuk-forms/forms-admin
that referenced
this pull request
Aug 29, 2025
In forms-api PR govuk-forms/forms-api#790 we increased the precision of timestamps when serializing to the maximum; we should do the same in forms-admin. Co-authored-by: Samuel Culley <samuel.culley@digital.cabinet-office.gov.uk> Co-authored-by: Stephen Daly <stephen.daly@digital.cabinet-office.gov.uk> Co-authored-by: Laurence de Bruxelles <laurence.debruxelles@dsit.gov.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What problem does this pull request solve?
Currently we store timestamps with microsecond precision (the default and maximum for PostgreSQL), but over the wire we only send milliseconds (the default for Rails). This is fine for most purposes, but as we're migrating data from forms-api to forms-admin at the moment it's helpful to get the full precision so we can easily compare the contents of the two databases without noise from truncated timestamps.
This commit uses the ActiveSupport configuration parameter to change the
TimeWithZone#as_jsonmethod to return all 6 digits of precision.Things to consider when reviewing