title: Saving the val return from ionic-datepicker into Firebase
body: <p>I am using ionic-datepicker (<a href="https://github.com/rajeshwarpatlolla/ionic-datepicker" rel="nofollow">ionic -datepicker</a>) to let user pick a time. I have this code in my controller to return the val user picked: </p>
  
  <pre><code>$scope.datePickerCallback = function (val) {
          if(typeof(val)==='undefined'){      
              console.log('Date not selected');
          }else{
              console.log('Selected date is : ', val);
              $scope.pickedDate = val;
          }
      };
  </code></pre>
  
  <p>Then I try to $add the task object (contain this val in one of its property like task.date) into an $firebaseArray. My firebase keep return a permission denied: </p>
  
  <pre><code>FIREBASE WARNING: set at /tasks/-JwIkrTLg5XvrhjLVRTJ failed: permission_denied 
  </code></pre>
  
  <p>I console log it before add into firebase. The output of the date property is:</p>
  
  <p>date:  Fri Aug 21 2015 00:00:00 GMT-0700 (PDT) 
  The <strong>proto</strong>: Invalid Date. </p>
  
  <p>So how to save a date object into Firebase? Do I need to set some rules for that? Or do I need to do something with the val to save it. One thing I need to do is to have the val like Firebase.ServerValue.TIMESTAMP. So I can convert the date value into different readable time format, do time calculation and all sort of stuffs. I can convert the val to String and save successfully in Firebase. But I will lost all the functionality a date object can do (like with moment.js with the return value)</p>