JSON Date Parsing to localstorage


I am creating a visitor management app that allows visitors to sign in and out when they are leaving.

So far, I have been able to store the names in localstorage but I need to automatically store the date and time as well.

Any suggestions on how I could go about this?

If I have understood right, you want to store the datetime when the user sign in/out. Well, in this case, you can do something like that:

$scope.signIn = function(){
  userData = $scope.user;
  userData.userDateTime = new Date().toISOString();
  window.localStorage["userData"] = JSON.stringify(userData);

Thanks raphael! thats really helpful