@@ -828,7 +828,7 @@ fn tz_abbrev_to_iana(abbrev: &str) -> Option<&str> {
828828/// If an abbreviation is found and the date is parsable, returns `Some(Zoned)`.
829829/// Returns `None` if no abbreviation is detected or if parsing fails, indicating
830830/// that standard parsing should be attempted.
831- fn try_parse_with_abbreviation < S : AsRef < str > > ( date_str : S ) -> Option < Zoned > {
831+ fn try_parse_with_abbreviation < S : AsRef < str > > ( date_str : S , now : & Zoned ) -> Option < Zoned > {
832832 let s = date_str. as_ref ( ) ;
833833
834834 // Look for timezone abbreviation at the end of the string
@@ -845,7 +845,9 @@ fn try_parse_with_abbreviation<S: AsRef<str>>(date_str: S) -> Option<Zoned> {
845845 // Parse the date part (everything before the TZ abbreviation)
846846 let date_part = s. trim_end_matches ( last_word) . trim ( ) ;
847847 // Parse in the target timezone so "10:30 EDT" means 10:30 in EDT
848- if let Ok ( parsed) = parse_datetime:: parse_datetime ( date_part) {
848+ if let Ok ( parsed) =
849+ parse_datetime:: parse_datetime_at_date ( now. clone ( ) , date_part)
850+ {
849851 let dt = parsed. datetime ( ) ;
850852 if let Ok ( zoned) = dt. to_zoned ( tz) {
851853 return Some ( zoned) ;
@@ -898,7 +900,7 @@ fn parse_date<S: AsRef<str> + Clone>(
898900 }
899901
900902 // First, try to parse any timezone abbreviations
901- if let Some ( zoned) = try_parse_with_abbreviation ( input_str) {
903+ if let Some ( zoned) = try_parse_with_abbreviation ( input_str, now ) {
902904 if dbg_opts. debug {
903905 eprintln ! (
904906 "date: parsed date part: (Y-M-D) {}" ,
@@ -1099,6 +1101,14 @@ mod tests {
10991101 assert_eq ! ( parse_military_timezone_with_offset( "9m" ) , None ) ; // Starts with digit
11001102 }
11011103
1104+ #[ test]
1105+ fn test_abbreviation_resolves_relative_date_against_now ( ) {
1106+ let now = "2025-03-15T20:00:00+00:00[UTC]" . parse :: < Zoned > ( ) . unwrap ( ) ;
1107+ let result =
1108+ parse_date ( "yesterday 10:00 GMT" , & now, DebugOptions :: new ( false , false ) ) . unwrap ( ) ;
1109+ assert_eq ! ( result. date( ) , jiff:: civil:: date( 2025 , 3 , 14 ) ) ;
1110+ }
1111+
11021112 #[ test]
11031113 fn test_utc_conversion_preserves_offset ( ) {
11041114 let now = Zoned :: now ( ) ;
0 commit comments