YassSoliman / chatroom-project

A chatroom made using socket.io
https://practical-chatroom.herokuapp.com/
0 stars 0 forks source link

Add timestamps #13

Closed YassSoliman closed 6 years ago

YassSoliman commented 6 years ago

Added timestamps with socket.io's handshake object which gives a lot of information back including the date of creation of said handshake as a string, formatted it into a date, used the new Date(); object with it's .toLocaleTimeString();function since it does the job for us: Formats the date to the local user's time and the devices time format. Made sure that the user sending the message doesn't get the handshake from the server but instead just makes a date object and appends it to his chat message.