ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀
https://ratatui.rs
MIT License
8.87k stars 269 forks source link

Is it possible for the calendar widget to use chrono instead? #1216

Open InnocentZero opened 3 days ago

InnocentZero commented 3 days ago

Problem

The current calendar widget utilizes time crate. While being a good crate, chrono is far richer in terms of API and I already integrated it in my project so it's hard to switch.

Solution

We can guard the two backends for calendar using feature flags if needed.

Alternatives

Cursive has a third party widget (they call it view) that utilizes chrono here. However, I believe ratatui would fit my purposes better so I'd like to use this if possible.

Additional context

I'd also like to have a go at this and implement these features myself but I might occasionally ask the maintainers for help with understanding the code if it's alright :sweat_smile:

joshka commented 3 days ago

I'd also like to have a go at this and implement these features myself but I might occasionally ask the maintainers for help with understanding the code if it's alright 😅

Sure thing. The reason for putting the calendar behind a feature flag in the first place was to avoid the time dependency. The only concern I have is that feature flags tend to be additive rather than alternative, but I suspect this is not really a big deal for this widget as there isn't any obvious use case for extending it from another crate (I think this is a safe-ish assumption).

Cursive has a third party widget (they call it view) that utilizes chrono here. However, I believe ratatui would fit my purposes better so I'd like to use this if possible.

It would be great to see those same views in the Calendar widget someday.