Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/javascript/controllers/deadline_day_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class extends Controller {

if (this.byDayOfMonthTarget.checked && this.dayOfMonthTarget.value) {
const rule = new RRule({
dtstart: today,
dtstart: new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate(), 12)),
freq: RRule.MONTHLY,
interval: monthlyInterval,
bymonthday: parseInt(this.dayOfMonthTarget.value),
Expand All @@ -57,7 +57,7 @@ export default class extends Controller {
}
if (this.byDayOfWeekTarget.checked && this.everyNthDayTarget.value && (this.dayOfWeekTarget.value)) {
const rule = new RRule({
dtstart: today,
dtstart: new Date(Date.UTC(today.getFullYear(), today.getMonth(), today.getDate(), 12)),
freq: RRule.MONTHLY,
interval: monthlyInterval,
byweekday: WEEKDAY_NUM_TO_OBJ[ parseInt(this.dayOfWeekTarget.value) ].nth( parseInt(this.everyNthDayTarget.value) ),
Expand Down
5 changes: 5 additions & 0 deletions spec/support/deadline_day_fields_shared_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ def safe_subtract_days(date, num)
expect(page).to have_content("Deadline day must be between 1 and 28")
end

# These tests make assertions about the dates calculated by the javascript in deadline_day_controller.js
# Because we currently don't have a great way of spoofing the date the headless browser sees during tests, they
# cannot effectively set the date for the tests (like with travel_to) and have to make due with the actual datetime
# of whenever the test is run. To the best of my knowledge, the tests are sound but be aware that they could
# pass or fail based on when they are run!
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not. I'll give them a look and see if I can apply them to the deadline_day_fields_shared_example.rb tests.

describe "reported reminder and deadline dates" do
context "when the reminder is a day of the month" do
before do
Expand Down