Skip to content

Commit e9fae4f

Browse files
authored
Merge pull request #5352 from Benjamin-Couey/4473-post-pr-bugfix
4473 post pr bugfix
2 parents 3689e4b + 15b7005 commit e9fae4f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/javascript/controllers/deadline_day_controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class extends Controller {
4747

4848
if (this.byDayOfMonthTarget.checked && this.dayOfMonthTarget.value) {
4949
const rule = new RRule({
50-
dtstart: today,
50+
dtstart: new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate(), 12)),
5151
freq: RRule.MONTHLY,
5252
interval: monthlyInterval,
5353
bymonthday: parseInt(this.dayOfMonthTarget.value),
@@ -57,7 +57,7 @@ export default class extends Controller {
5757
}
5858
if (this.byDayOfWeekTarget.checked && this.everyNthDayTarget.value && (this.dayOfWeekTarget.value)) {
5959
const rule = new RRule({
60-
dtstart: today,
60+
dtstart: new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate(), 12)),
6161
freq: RRule.MONTHLY,
6262
interval: monthlyInterval,
6363
byweekday: WEEKDAY_NUM_TO_OBJ[ parseInt(this.dayOfWeekTarget.value) ].nth( parseInt(this.everyNthDayTarget.value) ),

spec/support/deadline_day_fields_shared_example.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def safe_subtract_days(date, num)
7474
expect(page).to have_content("Deadline day must be between 1 and 28")
7575
end
7676

77+
# These tests make assertions about the dates calculated by the javascript in deadline_day_controller.js
78+
# Because we currently don't have a great way of spoofing the date the headless browser sees during tests, they
79+
# cannot effectively set the date for the tests (like with travel_to) and have to make due with the actual datetime
80+
# of whenever the test is run. To the best of my knowledge, the tests are sound but be aware that they could
81+
# pass or fail based on when they are run!
7782
describe "reported reminder and deadline dates" do
7883
context "when the reminder is a day of the month" do
7984
before do

0 commit comments

Comments
 (0)