taking local timezone as default

This commit is contained in:
Loïc Riegel 2025-04-04 18:26:43 +02:00
parent 3c75eb077d
commit f9b6b245b7

View File

@ -690,22 +690,18 @@ fn merge_record(record: &Record, head: Span, span: Span) -> Value {
},
};
let offset = match parse_timezone_from_record(record, &head, &span) {
let offset: FixedOffset = match record.get("timezone") {
Some(timezone) => {
let offset = match parse_timezone_from_record(timezone, &head, &span) {
Ok(value) => value,
Err(err) => {
return err;
}
};
dbg!(&year);
dbg!(&month);
dbg!(&day);
dbg!(&hour);
dbg!(&minute);
dbg!(&second);
dbg!(&millisecond);
dbg!(&microsecond);
dbg!(&nanosecond);
offset
}
None => now.offset().to_owned(),
};
let total_nanoseconds = nanosecond + microsecond * 1_000 + millisecond * 1_000_000;
@ -792,12 +788,11 @@ fn parse_value_from_record_as_u32(
}
fn parse_timezone_from_record(
record: &Record,
timezone: &Value,
head: &Span,
span: &Span,
) -> Result<FixedOffset, Value> {
match record.get("timezone") {
Some(val) => match val {
match timezone {
Value::String { val, internal_span } => {
let offset: FixedOffset = match val.parse() {
Ok(offset) => offset,
@ -823,8 +818,6 @@ fn parse_timezone_from_record(
},
*span,
)),
},
None => Ok(FixedOffset::east_opt(0).expect("Should never fail")),
}
}