Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update verseOfTheDay.js #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Ajay-006
Copy link

The Expiration is often compared using the day numbers. It was now replaced to compare with the dates itself.

The Expiration is often compared using the day numbers. It was now replaced to compare with the dates itself.
@stoiandan
Copy link
Owner

Hi @Ajay-006 !
You're welcome to contribute, thank you for your interest!
Your fix is almost done, but you need to change something.

By simply instantiating a new Date(), it will give you the date and time, with hours, minutes and seconds (yes, it's called Date, a bit confusing). You can check it out in the console:
image

So then, two dates will only be equal if they happened in the same date, up to the same second!
What you want to do is after instantiating a new Date(), is to call the toLocaleDateString(), this will only yield the "date" as in 26/06/2021.
Also, would you be kind enough to rename the global varriable to currentDate and the local const to dateNow? I think those will be better names

@Ajay-006
Copy link
Author

Ajay-006 commented Jun 26, 2021 via email

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.

2 participants