Making a polling app - how to limit votes to once every 24 hours


#1

I am making a polling app which will only allow the user to cast a vote every 24 hours.

I have is so that it checks the time and then sees if the elapsed time is greater than 86400000.

The bit I want to know is a good way to check the INITIAL vote, as there is no date stamp for that user voting yet.

Any ideas?


#2

I don’t think this is specific to Meteor.
You could just check for the timestamp being undefined and change it to “0” if so, so that the elapsed time will equal the current unix timestamp and be bigger than 86400000. It’s verbose enough if you add a comment in my opinion.