From e8209c511fedcd686af7cb9396d6257f93800bdf Mon Sep 17 00:00:00 2001 From: sava Date: Thu, 26 Mar 2020 16:10:55 +0100 Subject: [PATCH] finally workig timestamp --- it1/bibliotek/bibliotek.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/it1/bibliotek/bibliotek.js b/it1/bibliotek/bibliotek.js index 52d1217..8c918f7 100644 --- a/it1/bibliotek/bibliotek.js +++ b/it1/bibliotek/bibliotek.js @@ -1,11 +1,12 @@ var add = function() { + let millis = Date.parse($('#published')[0].value) db.collection("bibliotek").add({ tittel: $('#title')[0].value, forfatter: $('#author')[0].value, forlag: $('#publisher')[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() { $('#status').html('

La til bok '+$('#title')[0].value+'!

') }).catch(function() {