Skip to content

Commit

Permalink
Hijack daylight for longer night mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daneden committed Apr 17, 2017
1 parent d15d7f9 commit 6a9517c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Lucid",
"version": "0.1.2",
"version": "0.1.3",
"manifest_version": 2,
"description": "Replace your new tab page with a simple notepad.",
"homepage_url": "https://github.com/daneden/chrome-lucid",
Expand Down
6 changes: 4 additions & 2 deletions src/override/override.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ function findDaylightAndAct(now, lat, lng, storeKey) {
findDaylight(lat, lng)
.then(res => res.results)
.then(daylight => {
let sunrise = new Date(daylight.sunrise)
let sunset = new Date(daylight.sunset)
const ONE_HOUR = 60 * 60 * 1000
// Add an hour to our sunrise/set times because of ambient daylight
let sunrise = new Date(daylight.sunrise + ONE_HOUR)
let sunset = new Date(daylight.sunset + ONE_HOUR)

if(now < sunrise || now > sunset) {
toggleDaylight(false, true, storeKey)
Expand Down

0 comments on commit 6a9517c

Please sign in to comment.