Skip to content

Commit

Permalink
feat: removed unused sun-percentage-calculator.ts and simplifyed dayl…
Browse files Browse the repository at this point in the history
…ight-percentage-calculator.ts
  • Loading branch information
virus-rpi committed Nov 20, 2023
1 parent e2b946a commit a50fd2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ export const getSunlightPercentage = (
sunsetTime: number,
time: number,
) => {
const totalDaylightMinutes = (sunsetTime - sunriseTime) / (1000 * 60);
const totalDaylightMinutes = sunsetTime - sunriseTime;
if (totalDaylightMinutes <= 0) {
return 20;
}
const currentMinutes = (time - sunriseTime) / (1000 * 60);
const currentMinutes = time - sunriseTime;
const sunlightPercentage = (currentMinutes / totalDaylightMinutes) * 100;

if (sunlightPercentage < 0) {
Expand All @@ -24,11 +24,11 @@ export const getNighttimePercentage = (
sunsetTime: number,
time: number,
) => {
const totalNighttimeMinutes = (sunriseTime - sunsetTime) / (1000 * 60);
const totalNighttimeMinutes = sunriseTime - sunsetTime;
if (totalNighttimeMinutes <= 0) {
return 0;
}
const currentMinutes = (time - sunsetTime) / (1000 * 60);
const currentMinutes = time - sunsetTime;
const nighttimePercentage = (currentMinutes / totalNighttimeMinutes) * 100;

if (nighttimePercentage < 0) {
Expand Down

This file was deleted.

0 comments on commit a50fd2b

Please sign in to comment.