mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-17 02:32:56 +00:00
feat!: parsing local timestamp (#1352)
* fix: parse and display timestamp/datetime in local time zone * fix display * fix: unit tests * change time zone env * fix: remove useless code
This commit is contained in:
@@ -487,15 +487,16 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
pub fn test_parse_datetime_literal() {
|
||||
std::env::set_var("TZ", "Asia/Shanghai");
|
||||
let value = sql_value_to_value(
|
||||
"datetime_col",
|
||||
&ConcreteDataType::datetime_datatype(),
|
||||
&SqlValue::DoubleQuotedString("2022-02-22 00:01:03".to_string()),
|
||||
&SqlValue::DoubleQuotedString("2022-02-22 00:01:03+0800".to_string()),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(ConcreteDataType::datetime_datatype(), value.data_type());
|
||||
if let Value::DateTime(d) = value {
|
||||
assert_eq!("2022-02-22 00:01:03", d.to_string());
|
||||
assert_eq!("2022-02-22 00:01:03+0800", d.to_string());
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user