Skip to content

Commit

Permalink
edit default weekday to be number_from_sunday
Browse files Browse the repository at this point in the history
  • Loading branch information
dust1 committed Sep 24, 2021
1 parent 35c9b09 commit c9deea5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/functions/src/scalars/dates/week_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ impl WeekResultFunction<u32> for ToStartOfWeek {
}
fn to_number(value: DateTime<Utc>, mode: Option<u64>) -> u32 {
let week_mode = mode.unwrap_or(0);
let mut weekday = value.weekday().number_from_monday();
if (week_mode & 1) == 0 {
weekday = value.weekday().number_from_sunday();
let mut weekday = value.weekday().number_from_sunday();
if week_mode & 1 == 1 {
weekday = value.weekday().number_from_monday();
}
weekday -= 1;
let duration = Duration::days(weekday as i64);
Expand Down

0 comments on commit c9deea5

Please sign in to comment.