Repository navigation
calendar: Replace chrono with jiff - #4015
Merged
madcodelife merged 2 commits intoNov 17, 2026
Merged
Conversation
RUSTSEC-2026-0543 marks chrono unmaintained, so `cargo deny` fails for
applications that depend on gpui-kit. The advisory and chrono's maintainer
recommend jiff.
The Calendar, DatePicker and TimeField now take `jiff::civil::{Date, Time,
DateTime, Weekday}` instead of chrono's naive types. This is a breaking change
to their public API.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
💡 Needs the maintainer's call: clean port, but it swaps a public dependency (breaking API for every Calendar/DatePicker/TimeField user). Reviewed at 7059b1f.
The remaining decision is whether gpui-kit wants |
Member
|
✅ Accepted: the maintainer agreed to move from chrono to jiff. Since this changes the public types of the calendar, date picker and time input APIs, it will ship in the next minor (breaking) release, not a patch. Please keep the branch up to date with main; we will merge it once CI is green. Reviewed at 7059b1f. |
madcodelife
approved these changes
Nov 17, 2026
Member
|
Thank you! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes: no issue; sent directly as a PR, as CONTRIBUTING prefers.
Description
Replace
chronowithjiff1.0 in the Calendar, DatePicker and TimeField, and removechronofrom every manifest in the workspace.RUSTSEC-2026-0543 marks
chronoas unmaintained, socargo deny check advisoriesfails for every application that depends ongpui-kit. The advisory and chrono's maintainer (chronotope/chrono#1768) recommendjiffas the replacement.Scope:
gpui-base: this touches the Base layer because the date and time types are part of its public API (Date,Matcher,CalendarState,TimeFieldState); the component layer only re-exports them.calendar.rsandtime_field.rsusejiff::civil::{Date, Time, Weekday}. The month grid is built withDate::series; behaviour is unchanged (the existing tests pass as they were, apart from constructing dates withcivil::date).gpui-component:time/date_picker.rsandtime/calendar.rsfollow.time/utils.rsis deleted: it is not declared intime/mod.rs, so it was never compiled, and it only referencedchrono.gpui-shell: the calendar binding parses"YYYY-MM-DD"withcivil::Date::strptime, and the bundle writer reads the local time fromjiff::ZonedDateTime::now().gpui-kitintegration test and the website docs (en and zh-CN) are updated to jiff.wasm32,gpui-baseenables jiff'sjsfeature soCalendarState::newcan still read today's date in the browser, as chrono's defaultwasmbindfeature did.strftimeaccepts the same%Y,%m,%d,%H,%M,%S,%Iand%pdirectives used here.AI-generated: the port, the docs changes and this description were written with AI (Claude Code).
After this PR,
chronoremains inCargo.lockonly throughgpui-pre-scheduler(upstream Zed), which is outside this repository.Public API
gpui-base(re-exported fromgpui_component::calendarandgpui_component::time_field):Date::Single(Option<jiff::civil::Date>),Date::Range(Option<jiff::civil::Date>, Option<jiff::civil::Date>): the calendar value.impl From<jiff::civil::Date> for Date,impl From<(jiff::civil::Date, jiff::civil::Date)> for Date: build a single date or a range.Date::start(&self) -> Option<jiff::civil::Date>,Date::end(&self) -> Option<jiff::civil::Date>: read the range ends.Date::is_active(&self, &jiff::civil::Date) -> bool,Date::is_in_range(&self, &jiff::civil::Date) -> bool: hit tests for a day cell.Date::format(&self, &str) -> Option<SharedString>: now formats with jiff'sstrftime.Matcher::Custom(Box<dyn Fn(&jiff::civil::Date) -> bool + Send + Sync>),Matcher::custom,Matcher::interval(Option<jiff::civil::Date>, Option<jiff::civil::Date>),Matcher::range(..),Matcher::matched(&self, &jiff::civil::Date) -> bool,impl<F: Fn(&jiff::civil::Date) -> bool> From<F> for Matcher: disable dates.CalendarState::select_date(&mut self, jiff::civil::Date) -> bool,CalendarState::activate_date(&mut self, jiff::civil::Date, &mut Context<Self>) -> bool: select a day.CalendarState::days(&self) -> Vec<Vec<jiff::civil::Date>>,CalendarState::month_days(&self) -> Vec<Vec<Vec<jiff::civil::Date>>>,CalendarState::today(&self) -> jiff::civil::Date: the visible grid and today.Calendar::first_day_of_week(self, jiff::civil::Weekday) -> Self: the first column of the grid.TimePrecision::truncate(self, jiff::civil::Time) -> jiff::civil::Time: drop components finer than the precision.TimeFieldEvent::Change(jiff::civil::Time),TimeFieldState::time(&self) -> jiff::civil::Time,TimeFieldState::set_time(&mut self, jiff::civil::Time, &mut Window, &mut Context<Self>): the edited time.gpui-component:date_picker::DateTime::Single(Option<jiff::civil::DateTime>),DateTime::Range(Option<jiff::civil::DateTime>, Option<jiff::civil::DateTime>),DateTime::start,DateTime::end,impl From<jiff::civil::DateTime> for DateTime,impl From<(jiff::civil::DateTime, jiff::civil::DateTime)> for DateTime: the date-time value.DateRangePresetValue::Single(jiff::civil::Date),DateRangePresetValue::Range(jiff::civil::Date, jiff::civil::Date),DateRangePreset::single(label, jiff::civil::Date),DateRangePreset::range(label, jiff::civil::Date, jiff::civil::Date): presets.DatePickerState::default_time(self, jiff::civil::Time) -> Self,DatePickerState::first_day_of_week(self, jiff::civil::Weekday) -> Self: configuration.calendar::Calendar::first_day_of_week(self, jiff::civil::Weekday) -> Self: the first column of the grid.Breaking Changes
Every item above took a
chronotype and now takes the matchingjifftype, so applications using the Calendar, DatePicker or TimeField replacechronowithjiff = "1.0"in their own manifest:NaiveDatejiff::civil::DateNaiveTimejiff::civil::TimeNaiveDateTimejiff::civil::DateTimeWeekday::Sun,Weekday::Mon, …Weekday::Sunday,Weekday::Monday, …Local::now().naive_local().date()jiff::ZonedDateTime::now().date()Year, month and day accessors on jiff dates return
i16/i8instead of chrono'si32/u32.CalendarState::current_year,current_monthandset_year_rangekeep their existing types.How to Test
Run on macOS ARM64.
With Rust 1.100.0:
cargo clippy --workspace --exclude gpui-shell --exclude webview --locked -- --deny warnings: clean.cargo clippy -p gpui-shell --all-targets --locked -- --deny warnings: clean.cargo machete: no unused dependencies.With Rust 1.98.1:
cargo test -p gpui-base --lib -- calendar time_field,cargo test -p gpui-component --features test-support --lib -- time::,cargo test -p gpui-shell --lib bundlecargo test -p gpui-kit --features test-support --test integration date_pickercargo check -p gpui-base -p gpui-component -p gpui-kit -p gpui-component-story --tests --features gpui-component-story/test-supportcargo check -p gpui-kit --features gpui-fast --target wasm32-unknown-unknownonnightly-2026-10-31Stories (
cargo run, macOS): Calendar, DatePicker and TimeField render as before. Today's date and the local time come from jiff; the month grids are right across the November → December 2026 → January 2027 rollover; the weekend matcher greys Saturday and Sunday; the "Yesterday" preset selects the previous day and reports2026-11-16; the 12-hour TimeField showsAM.Checklist
cargo runfor story tests related to the changes.🤖 Generated with Claude Code