Skip to content

Conversation

@HazemHassan03
Copy link

Hi Mr. Elzero, I hope you are well.
I was watching the Pull Request lesson in the Git & GitHub Course, so I wanted to apply what I learned.
So I searched for any bug or fix to maintain it and create a pull request to you.
Then, I noticed that there was a bug in the "Latest Events" section in this project.

  • What is the problem?
    According to the JS code in the main.js file from line 9 to 34, it runs the code inside the setInterval first, Then it checks whether the date has reached the current date or not.
    If the date hasn't reached the current date, it works.
    But if the date has reached the current date, it will run the code before this check first, then it finds that the date has reached the current date so it runs clearInterval. So if the current date is after the date in the JS code It will count negatively and display wrong values in the page.

  • What did I do?
    First, I make the values in the HTML file "00".
    Second, I made some changes in the JS file:

  1. I moved the check of date difference outside the setInterval.
  2. Then, check if the difference is more than 0 it will run the setInterval and update the values of dateNow and dateDiff every time.
  3. If the difference is not more than 0, the values in the HTML file are already "00", which means that the event has started.
    Finally, I noticed that when the value of numbers is big, they are not displayed correctly. So I made a few changes in the CSS styles.

I hope these changes are useful for this project. And I want to thank you for all the courses and efforts you make for us.
Thanks for your time.

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.

1 participant