Skip to content

Commit

Permalink
Resolve follow-up comments to unicode-org#3760 (unicode-org#3818)
Browse files Browse the repository at this point in the history
* Docs for `U` and `r`

* Delete empty test and add todo

* Remove old code and empty era check

* Add todo
  • Loading branch information
atcupps authored Aug 9, 2023
1 parent ff3c7e1 commit 57e9d59
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/datetime/src/fields/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ field_type! (
///
/// This works for “week of year” based calendars in which the year transition occurs on a week boundary; may differ from calendar year [`Year::Calendar`] near a year transition. This numeric year designation is used in conjunction with [`Week::WeekOfYear`], but can be used in non-Gregorian based calendar systems where week date processing is desired. The field length is interpreted in the same way as for [`Year::Calendar`].
'Y' => WeekOf = 1,
/// TODO: Docs
/// Field symbol for cyclic year; used in calendars where years are tracked in cycles, such as the Chinese or Dangi calendars.
'U' => Cyclic = 2,
/// TODO: Docs
/// Field symbol for related ISO; some calendars which use different year numbering than ISO, or no year numbering, may express years in an ISO year corresponding to a calendar year.
'r' => RelatedIso = 3,
};
Numeric;
Expand Down
5 changes: 1 addition & 4 deletions components/datetime/src/format/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ where
.ok_or(Error::MissingDateSymbols)?
.get_symbols_for_month(month, length)?;
w.write_str(symbols.get(code).ok_or(Error::MissingMonthSymbol(code))?)?;
w.write_str("(leap)")?;
w.write_str("(leap)")?; // This is temporary; TODO(#3766) add support for leap months
}
}
},
Expand Down Expand Up @@ -640,7 +640,4 @@ mod tests {
}
}
}

#[test]
fn test_year_formatting() {}
}
3 changes: 0 additions & 3 deletions components/datetime/src/provider/date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,6 @@ impl<'data> DateSymbols<'data> for provider::calendar::DateSymbolsV1<'data> {
fields::FieldLength::Narrow => &self.eras.narrow,
_ => &self.eras.abbr,
};
if symbols.is_empty() {
return ""; // If symbols is empty, this calendar doesn't use eras (ex. Chinese)
}
symbols
.get(era_code.0.as_str().into())
.unwrap_or(&era_code.0)
Expand Down
1 change: 0 additions & 1 deletion provider/datagen/src/transform/cldr/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ macro_rules! impl_data_provider {

let mundi_name = ethioaa_data
.eras
// .ok_or_else(|| DataError::custom("Could not find eras"))?
.names
.get("0")
.expect("ethiopic-amete-alem calendar must have 0 era");
Expand Down
2 changes: 1 addition & 1 deletion provider/datagen/src/transform/cldr/datetime/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn get_month_code_map(calendar: &str) -> &'static [TinyStr4] {
"gregory" | "buddhist" | "japanese" | "japanext" | "indian" | "persian" | "roc" => {
&SOLAR_MONTH_CODES[0..12]
}
"coptic" | "ethiopic" | "chinese" => SOLAR_MONTH_CODES,
"coptic" | "ethiopic" | "chinese" => SOLAR_MONTH_CODES, // TODO(#3766): Fix leap month formatting
_ => panic!("Month map unknown for {calendar}"),
}
}
Expand Down

0 comments on commit 57e9d59

Please sign in to comment.