Skip to content

Homework JS 3 Week1#1

Closed
AlfiYusrina wants to merge 3 commits into
tchapeaux:masterfrom
AlfiYusrina:week1
Closed

Homework JS 3 Week1#1
AlfiYusrina wants to merge 3 commits into
tchapeaux:masterfrom
AlfiYusrina:week1

Conversation

@AlfiYusrina
Copy link
Copy Markdown

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

@warrieka
Copy link
Copy Markdown
Collaborator

warrieka commented May 30, 2019

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

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 )

Copy link
Copy Markdown
Owner

@tchapeaux tchapeaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

image

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.

@tchapeaux
Copy link
Copy Markdown
Owner

You can submit the changes with your homework for week 2, so I'm closing this one now :-)

@tchapeaux tchapeaux closed this Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants