How to add ionic datepicker date in firebase

i want to add this plugin ( date in firebase database. how to do this ?

Firebase doesn’t support the Date format. Store it as a json.

var ipObj1 = {
callback: function (val) { //Mandatory
console.log('Return value from the datepicker popup is : ’ + val, new Date(val));

    $scope.selectedDate1 = new Date(val);

how to store $scope.selectedDate1 in firebase please give me code example