finally workig timestamp

This commit is contained in:
sava 2020-03-26 16:10:55 +01:00
parent 13b31b50f7
commit e8209c511f

View File

@ -1,11 +1,12 @@
var add = function() { var add = function() {
let millis = Date.parse($('#published')[0].value)
db.collection("bibliotek").add({ db.collection("bibliotek").add({
tittel: $('#title')[0].value, tittel: $('#title')[0].value,
forfatter: $('#author')[0].value, forfatter: $('#author')[0].value,
forlag: $('#publisher')[0].value, forlag: $('#publisher')[0].value,
terningkast: $('#rating')[0].value, terningkast: $('#rating')[0].value,
utgitt: new firebase.firestore.Timestamp(Date.parse(Date($('#published')[0].value))/1000, 0) utgitt: new firebase.firestore.Timestamp(millis/1000, 0)
}).then(function() { }).then(function() {
$('#status').html('<p style="color: green;">La til bok '+$('#title')[0].value+'!</p>') $('#status').html('<p style="color: green;">La til bok '+$('#title')[0].value+'!</p>')
}).catch(function() { }).catch(function() {