taa176 / web

Website. Welcome.
0 stars 0 forks source link

Chat date displaying incorrectly #1

Closed k-hendricks closed 4 years ago

k-hendricks commented 4 years ago

Okay so this is fixed, but just for reference, because javascript was apparently written by absolute idiots:

.getDay() pulls the day of the week, not the day of the month. This is indexed at 0 for Sunday through 6 for Saturday. .getDate() does not get the full date, as the name implies. It only gets the day of the month. Why? Idk can't make programming easy I guess. .getMonth() is indexed at 0. That's right. January is month 0 now. .getMinutes() doesn't append a zero to the start of minutes 0-9. So the time will display as 12:0 12:1 ... 12:9 12:10. I added an if statement to prepend a 0. @taa176