Skip to content

Commit 08c1fc5

Browse files
authored
Fix another Daylight Saving Time bug. Fix initial AM/PM state of edited alarm. (#88)
* That bug fix in 3.4.1? Turns out an alarm going off on the _same day_ clocks are changed could go off at the wrong time, not merely be displayed incorrectly. That's fixed now too. * Fix initial AM/PM state of edited alarm.
1 parent 95d569b commit 08c1fc5

9 files changed

Lines changed: 29 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 3.4.2
2+
3+
* That bug fix in 3.4.1? Turns out an alarm going off on the _same day_ clocks are changed could go off at the wrong time, not merely be displayed incorrectly. That's fixed now too.
4+
* Fix initial AM/PM state of edited alarm.
5+
16
## 3.4.1
27

38
* Fix a Daylight Saving Time bug that caused the displayed time for an upcoming alarm the day after a clock change to be off by an hour. (This self-corrected after midnight, and did not affect when the alarm actually went off.)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "3.4.1",
3+
"version": "3.4.2",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

sass/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-sass",
3-
"version": "3.4.1",
3+
"version": "3.4.2",
44
"description": "SASS builder for aw-clock",
55
"keywords": [
66
"sass"

server/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-server",
3-
"version": "3.4.1",
3+
"version": "3.4.2",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"private": true,

src/alarm-monitor.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export class AlarmMonitor {
5656
let updatePrefs = false;
5757
const now = new DateTime(alarmCheckTime, this.appService.timezone);
5858
const minutesInDay = now.getMinutesInDay();
59-
const wt = now.wallTime;
60-
const midnight = new DateTime([wt.y, wt.m, wt.d, 0, 0, 0], this.appService.timezone);
6159
const nowMinutes = floor(now.utcSeconds / 60);
6260
const newActiveAlarms = [];
6361
let sound = '';
@@ -78,10 +76,18 @@ export class AlarmMonitor {
7876

7977
if (snoozed)
8078
alarmTime = snoozed.restartAt;
81-
else if (isDaily)
82-
alarmTime = floor(midnight.utcSeconds / 60) + alarmTime;
83-
else
84-
alarmTime -= floor(now.utcOffsetSeconds / 60);
79+
else if (isDaily) {
80+
const wt = now.wallTime;
81+
const alarmDT = new DateTime([wt.y, wt.m, wt.d, floor(alarmTime / 60), alarmTime % 60], this.appService.timezone);
82+
83+
alarmTime = floor(alarmDT.utcSeconds / 60);
84+
}
85+
else {
86+
const wt = new DateTime(alarmTime * 60000, 'UTC').wallTime;
87+
const alarmDT = new DateTime([wt.y, wt.m, wt.d, wt.hrs, wt.min], this.appService.timezone);
88+
89+
alarmTime = floor(alarmDT.utcSeconds / 60);
90+
}
8591

8692
if (!snoozed) {
8793
if (!isDaily && alarmTime < nowMinutes - 65 && processMillis() > this.startTime + 60000) { // Expired alarm?

src/settings-dialog.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ export class SettingsDialog {
870870
this.dayOfWeekPanel.css('display', daily ? 'flex' : 'none');
871871
this.alarmHour.val(time.substring(0, 2));
872872
this.alarmMinute.val(time.substring(3, 5));
873-
this.alarmMeridiem.val(time.substring(7, 8));
873+
this.alarmMeridiem.val(time.substring(6, 7));
874874
this.alarmAudio.val(alarm.sound);
875875
this.alarmMessage.val(alarm.message);
876876

@@ -1089,7 +1089,8 @@ export class SettingsDialog {
10891089
this.alarmDelete.prop('disabled', true);
10901090
this.alarmEdit.prop('disabled', true);
10911091
this.clearAlarmTime();
1092-
this.renderAlarmList(this.newAlarms);
1092+
this.renderAlarmList([]);
1093+
setTimeout(() => this.renderAlarmList(this.newAlarms));
10931094

10941095
this.renderAlertFilterList(previousSettings.alertFilters);
10951096

0 commit comments

Comments
 (0)