Skip to content

Commit

Permalink
Fix calling toGMTString on lastModified (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
mabrikan committed Mar 5, 2023
1 parent 4fe066c commit 31d7e11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ async function scheduleNextAlarm(interval) {
}

async function handleLastModified(newLastModified) {
const lastModified = await localStore.get('lastModified') || new Date(0);
const lastModified = await localStore.get('lastModified') || new Date(0).toUTCString();

// Something has changed since we last accessed, display any new notificaitons
// Something has changed since we last accessed, display any new notifications
if (newLastModified !== lastModified) {
const {showDesktopNotif, playNotifSound} = await optionsStorage.getAll();
if (showDesktopNotif === true || playNotifSound === true) {
Expand Down
2 changes: 1 addition & 1 deletion source/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function getNotificationCount() {
const {headers, json: notifications} = await getNotificationResponse({maxItems: 1});

const interval = Number(headers.get('X-Poll-Interval'));
const lastModified = (new Date(headers.get('Last-Modified'))).toGMTString();
const lastModified = (new Date(headers.get('Last-Modified'))).toUTCString();
const linkHeader = headers.get('Link');

if (linkHeader === null) {
Expand Down
2 changes: 1 addition & 1 deletion source/lib/notifications-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function playNotificationSound() {
}

export async function checkNotifications(lastModified) {
let notifications = await getNotifications({lastModified: lastModified.toGMTString()});
let notifications = await getNotifications({lastModified});
const {showDesktopNotif, playNotifSound, filterNotifications} = await optionsStorage.getAll();

if (filterNotifications) {
Expand Down

0 comments on commit 31d7e11

Please sign in to comment.