-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push latest code with next birthday function
- Loading branch information
Showing
10 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"files": { | ||
"main.css": "/static/css/main.073c9b0a.css", | ||
"main.js": "/static/js/main.bf458550.js", | ||
"main.js": "/static/js/main.a353131e.js", | ||
"static/js/787.e3145bef.chunk.js": "/static/js/787.e3145bef.chunk.js", | ||
"index.html": "/index.html", | ||
"main.073c9b0a.css.map": "/static/css/main.073c9b0a.css.map", | ||
"main.bf458550.js.map": "/static/js/main.bf458550.js.map", | ||
"main.a353131e.js.map": "/static/js/main.a353131e.js.map", | ||
"787.e3145bef.chunk.js.map": "/static/js/787.e3145bef.chunk.js.map" | ||
}, | ||
"entrypoints": [ | ||
"static/css/main.073c9b0a.css", | ||
"static/js/main.bf458550.js" | ||
"static/js/main.a353131e.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="An answer to the question, how many cats do you have and how old are they?"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>How Old Are My Cats</title><script async src="https://www.googletagmanager.com/gtag/js?id=G-VRLRYJ97EF"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-VRLRYJ97EF")</script><script defer="defer" src="/static/js/main.bf458550.js"></script><link href="/static/css/main.073c9b0a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> | ||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="An answer to the question, how many cats do you have and how old are they?"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>How Old Are My Cats</title><script async src="https://www.googletagmanager.com/gtag/js?id=G-VRLRYJ97EF"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-VRLRYJ97EF")</script><script defer="defer" src="/static/js/main.a353131e.js"></script><link href="/static/css/main.073c9b0a.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import textContent from "./contents.json"; | ||
|
||
/** | ||
* This takes in the entire props structure and manipulates incoming string data to generate | ||
* a formatted output to be directly displayed. | ||
* @returns the next birthday details as a string used for the banner of the page | ||
*/ | ||
export function nextBirthdayAsStr(): string { | ||
let soonestName: string = "" | ||
let soonestDate: Date = new Date() | ||
let soonestDays: number = 99999 | ||
textContent.cards.forEach(details => { | ||
const date = new Date(details.birthdate); | ||
const todaysDate = new Date(); | ||
|
||
date.setFullYear(2000); | ||
todaysDate.setFullYear(2000); | ||
|
||
let diff = date.getTime() - todaysDate.getTime() | ||
var diffDays = Math.ceil(diff / (1000 * 3600 * 24)); | ||
|
||
// Number of diff days is in the future, and is less than current soonest days | ||
if (diffDays > 0 && diffDays < soonestDays) { | ||
soonestName = details.name | ||
soonestDate = new Date(details.birthdate) | ||
soonestDays = diffDays | ||
} | ||
}) | ||
|
||
return `${soonestName}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.