do not panic in truly invalid timestamps
This commit is contained in:
parent
a5422167cf
commit
eebf5a9d4c
1 changed files with 3 additions and 1 deletions
|
|
@ -437,7 +437,9 @@ impl<'a> FormatTime<'a> {
|
||||||
|
|
||||||
impl Display for FormatTime<'_> {
|
impl Display for FormatTime<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let zoned = jiff::Zoned::try_from(self.time).unwrap();
|
let Ok(zoned) = jiff::Zoned::try_from(self.time) else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
let now = jiff::Zoned::now();
|
let now = jiff::Zoned::now();
|
||||||
let icu_datetime = DateTime::convert_from(zoned.datetime());
|
let icu_datetime = DateTime::convert_from(zoned.datetime());
|
||||||
if zoned.date() == now.date() {
|
if zoned.date() == now.date() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue