Skip to content

Commit 69a48d4

Browse files
committed
chore: fix
1 parent 8892afe commit 69a48d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rust/cubesqlplanner/cubesqlplanner/src/planner/time_dimension/date_time_helper.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use chrono::{DateTime, Duration, LocalResult, NaiveDateTime, TimeZone};
1+
use chrono::{DateTime, Duration, LocalResult, NaiveDate, NaiveDateTime, TimeZone};
22
use chrono_tz::Tz;
33
use cubenativeutils::CubeError;
44
use lazy_static::lazy_static;
@@ -17,7 +17,6 @@ lazy_static! {
1717
impl QueryDateTimeHelper {
1818
pub fn parse_native_date_time(date: &str) -> Result<NaiveDateTime, CubeError> {
1919
let formats = &[
20-
"%Y-%m-%d",
2120
"%Y-%m-%d %H:%M:%S",
2221
"%Y-%m-%dT%H:%M:%S",
2322
"%Y-%m-%d %H:%M:%S%.f",
@@ -30,6 +29,10 @@ impl QueryDateTimeHelper {
3029
}
3130
}
3231

32+
if let Ok(d) = NaiveDate::parse_from_str(date, "%Y-%m-%d") {
33+
return Ok(d.and_hms_opt(0, 0, 0).unwrap());
34+
}
35+
3336
// Fallback as RFC3339/ISO8601 with 'Z' timezone
3437
if let Ok(dt) = DateTime::parse_from_rfc3339(date) {
3538
return Ok(dt.naive_utc());

0 commit comments

Comments
 (0)