Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update verseOfTheDay.js #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/verseOfTheDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const NEWS_FEED_URL = 'https://www.biblegateway.com/votd/get/?format=atom';

var VERSE_OF_THE_DAY;

var today = new Date().getDay();
var today = new Date();

async function fetchVerseOfTheDay() {
return await fetch(NEWS_FEED_URL).then(resp => resp.text())
Expand All @@ -27,7 +27,7 @@ async function fetchVerseOfTheDay() {
browser.runtime.onMessage.addListener(req => {
if (req.message === GET_VERSE_OF_THE_DAY) {
// get current day to see if verse has expired
const dayNow = new Date().getDay();
const dayNow = new Date();

if(!VERSE_OF_THE_DAY || dayNow !== today) {
VERSE_OF_THE_DAY = fetchVerseOfTheDay();
Expand All @@ -36,4 +36,4 @@ browser.runtime.onMessage.addListener(req => {
return Promise.resolve(VERSE_OF_THE_DAY);
}
return false;
});
});