Skip to content

Conversation

@kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Feb 2, 2026

Fixes #1371

@gemini-code-assist
Copy link

Summary of Changes

Hello @kevmoo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the json_serializable package by adding a new configuration option, dateTimeUtc, to the JsonSerializable annotation. This feature provides developers with fine-grained control over how DateTime objects are serialized to JSON, specifically allowing them to enforce UTC conversion. This ensures consistency in date-time representation across different systems and simplifies data exchange.

Highlights

  • New dateTimeUtc Configuration Option: Introduced a new dateTimeUtc field in the JsonSerializable annotation, allowing users to specify whether DateTime fields should be serialized to JSON in UTC format by default. This can be overridden per field using JsonKey.
  • Core Logic for UTC Conversion: Implemented the logic within DateTimeHelper to conditionally apply UTC conversion (toUtc().toIso8601String()) during serialization based on the dateTimeUtc configuration.
  • Package Version Updates and Documentation: Updated json_annotation to 4.11.0-wip and json_serializable to 6.13.0-wip, including corresponding changelog entries and README updates to reflect the new feature.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new dateTimeUtc option to JsonSerializable for controlling DateTime serialization, along with some minor cleanups. The implementation is solid and well-tested. I've found one minor issue with the documentation for the new option that should be addressed.

@kevmoo kevmoo changed the title utc silly Feature: add support for JsonSerializable.dateTimeUtc Feb 2, 2026
);

final dateTimeUtcString = ToFromStringHelper(
'DateTime.parse',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to ask a Q here:

Should the parser also call toLocal() here?

What are the implications of not converting this to local if the DateTime object is used in the UI with a DateFormat?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to change the current behavior AT ALL.

I think the current behavior is fine.

@kevmoo kevmoo requested a review from natebosch February 3, 2026 01:14
Copy link
Member

@natebosch natebosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the linked issue:

I'll mark this to consider for the next breaking change.

Do we think that UTC is a better default? Will we update this on the next breaking release?

I see the backwards compatibility argument, and I don't think I'd want to push for a non-breaking release with the default changed, but I wonder if we should be positioning this as the recommended path with an eye to remove it in some future version.

I think it's OK to land either way, but we might also want to think about the long term story for this edge of the design and how we'll get users to that end state.

@kevmoo
Copy link
Collaborator Author

kevmoo commented Feb 3, 2026

@natebosch – agreed. I have a long backlog of things to cleanup in the next major release. This would be one of them.

@kevmoo
Copy link
Collaborator Author

kevmoo commented Feb 3, 2026

...liking going to wait for augmentations to do it, though 😄

@kevmoo kevmoo merged commit fad91d9 into master Feb 3, 2026
19 checks passed
@kevmoo kevmoo deleted the utc_silly branch February 3, 2026 01:31
kevmoo added a commit that referenced this pull request Feb 4, 2026
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.

Proposal: Always convert DateTime to UTC during serialization

3 participants