Homework JS 3 Week1#1
Conversation
The simplest way: const dt = new Date();
console.log( dt.toDateString() ); See: https://www.w3schools.com/jsref/jsref_todatestring.asp If you don't like the output of this function then you have code something yourself. Vanilla Javascript does not have date formatting, you have to make something yourself or use a framework. Like: const months = ["JAN", "FEB", "MAR","APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
const current_datetime = new Date()
const formatted_date = current_datetime.getDate() + "-" + months[current_datetime.getMonth()] + "-" + current_datetime.getFullYear()
console.log( formatted_date ) |
tchapeaux
left a comment
There was a problem hiding this comment.
Hello Alfi, great work on the homework!
When testing your code in my browser, I see that each time a new repository is chosen in the dropdown, new rows are added in the left column, instead of the previous rows being replaced.
You can see this in this screenshot where I've clicked on a few repos:
This is due to a bug in the setRepo function, I think you want to pass another variable than tableRow as a parameter to removeAllChildren 😉
Except for that, your code seems clean and your function / variable names are clear. You could add a few comments to make it easier to review but that is minor.
|
You can submit the changes with your homework for week 2, so I'm closing this one now :-) |

How to format the date, without the time zone included?