Skip to content
Snippets Groups Projects
Commit 28daf73e authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #2427 from metabase/pulse-dow-alignment-fix

pulse day-of-week fix for Sunday
parents 6603cdfd a4eda491
Branches
Tags
No related merge requests found
......@@ -16,14 +16,15 @@
"Simple `vector` of the days in the week used for reference and lookups.
NOTE: order is important here!!
these indexes match the values from clj-time `day-of-week` function (0 = Sunday, 6 = Saturday)"
[{:id "sun", :name "Sun"},
{:id "mon", :name "Mon"},
we use the same ordering as the clj-time `day-of-week` function (1 = Monday, 7 = Sunday) except
that we are 0 based instead."
[{:id "mon", :name "Mon"},
{:id "tue", :name "Tue"},
{:id "wed", :name "Wed"},
{:id "thu", :name "Thu"},
{:id "fri", :name "Fri"},
{:id "sat", :name "Sat"}])
{:id "sat", :name "Sat"},
{:id "sun", :name "Sun"}])
(def ^{:arglists '([day])} day-of-week?
"Is DAY a valid `day-of-week` choice?"
......
......@@ -46,7 +46,9 @@
(time/now)
(time/to-time-zone (time/now) (time/time-zone-for-id reporting-timezone)))
curr-hour (time/hour now)
curr-weekday (->> (time/day-of-week now)
;; joda time produces values of 1-7 here (Mon -> Sun) and we subtract 1 from it to
;; make the values zero based to correspond to the indexes in pulse-channel/days-of-week
curr-weekday (->> (- (time/day-of-week now) 1)
(get pulse-channel/days-of-week)
:id)
curr-monthday (monthday now)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment