Skip to content

refactor(types)!: replace chrono with time - #164

Open
ricochet wants to merge 1 commit into
influxdata:mainfrom
ricochet:refactor/remove-chrono
Open

ricochet wants to merge 1 commit into
influxdata:mainfrom
ricochet:refactor/remove-chrono

Conversation

@ricochet

@ricochet ricochet commented Nov 19, 2026 •

Copy link
Copy Markdown

Closes #162.

Replace chrono with time for pbjson-types::Timestamp conversions and JSON serialization. time::OffsetDateTime supports the full Protobuf timestamp range, including 9999-12-31T23:59:59.999999999Z. Disable its default features and enable formatting, parsing, and format-description macros; no local timezone lookup is needed.

This is a breaking Rust API change: the conversion impls now use time::OffsetDateTime in place of chrono::DateTime<Utc>. The existing JSON output stays the same, including +00:00 and 0/3/6/9 fractional digits. Update the test workspace's native timestamp fixture and document the replacement conversion API.

Validate the Protobuf seconds range and nonnegative nanoseconds before serialization and after parsing offset timestamps. Regression tests cover both endpoints, fractional precision, normalized offsets before 1970, invalid fields, and offsets that would move an otherwise valid local date outside the Protobuf range. The workspace dependency tree contains no chrono.

Validated with the repository's Rust 1.91 toolchain:

  • cargo test --workspace, including the conversion doctest.
  • Each CI test feature separately: ignore-unknown-fields, btree, emit-fields, use-integers-for-enums, preserve-proto-field-names, and ignore-unknown-enum-variants.
  • cargo clippy --all-targets --workspace -- -D warnings.
  • cargo fmt --all -- --check.
  • cargo doc --document-private-items --no-deps --workspace.

Signed-off-by: Bailey Hayes <bailey@cosmonic.com>
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.

Removing unmaintained Chrono dependency

1 participant