Skip to content

Commit

Permalink
putting current days date into date input via js until I can figure o…
Browse files Browse the repository at this point in the history
…ut mongoDBs way
  • Loading branch information
flbarfield committed Oct 15, 2023
1 parent a4360c6 commit cc0238d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 0 additions & 1 deletion public/assets/css/fitnessApp.css
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ footer a {
#exerciseBank > * {
width: 100%;
padding: 0;
/* margin: 0 auto; */
}

#exerciseBank .bankLeft{
Expand Down
21 changes: 17 additions & 4 deletions public/assets/js/fitnessApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,24 @@ async function quoteApiRequest() {

}

// date setting
// date setting...for now. This needs to be done via backend so I can populate based off it.
function defaultDate () {
// let date = new Date().toISOString().substring(0, 10), field = document.getElementById('date')
// field.value = date
}
let myDate, day, month, year, date

myDate = new Date
day = myDate.getDate()
if (day < 10){
day = '0' + day
}
month = myDate.getMonth() + 1
if (month < 10){
month = '0' + month
}
year = myDate.getFullYear()
date = `${year}-${month}-${day}`

document.getElementById('date').value = date
}

//show exerciseBank
function showExerciseBank () {
Expand Down Expand Up @@ -139,6 +151,7 @@ const exercises = {
}
}

defaultDate()
populateExerciseBank()
quoteApiRequest()

2 changes: 1 addition & 1 deletion views/fitnessApp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<section id="content" class="main fitnessBody">
<span class="image main"><img class="fitnessAppImg" src="images/trainingPlaceholderLarge.jpg" alt="" /></span>
<section class="date">
<input id='date' type="date" value="">
<input id='date' type="date" value=""/>
</section>
<section class='exerciseList'>
<% exercises.forEach( el => { %>
Expand Down

0 comments on commit cc0238d

Please sign in to comment.