Skip to content

Commit

Permalink
Update sprout.js
Browse files Browse the repository at this point in the history
  • Loading branch information
camillereaves authored Sep 23, 2023
1 parent 3052be6 commit 858cfb7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions public/sprout.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ document.getElementById("login_form").addEventListener("submit", function (e) {
var address = document.getElementById("address").value;
var dateOfBirth = document.getElementById("dateofbirth").value;
var password = document.getElementById("password").value;
//const serverTimestamp = serverTimestamp()

var isValid = true;

Expand Down Expand Up @@ -149,10 +148,10 @@ document.getElementById("login_form").addEventListener("submit", function (e) {
return false;
}
else{
//var createDate = serverTimestamp.toDate()
//let month = String(createDate.getMonth()+1).padStart(2,"0");
//let year = String(createDate.getFullYear()).slice(0,2);
const date = new Date();
let month = String(date.getMonth()+1).padStart(2,"0");
let year = String(date.getFullYear()).slice(0,2);

const newUser = {
userEmail: userEmail,
firstName: firstName,
Expand All @@ -161,7 +160,7 @@ document.getElementById("login_form").addEventListener("submit", function (e) {
DOB : dateOfBirth,
password: password,
createdAt: serverTimestamp(),
username: firstName.slice(0,1) + lastName + String(serverTimestamp().toDate().getMonth()+1).padStart(2,"0") + String(serverTimestamp().toDate().getFullYear()).slice(0,2)
username: firstName.slice(0,1) + lastName + month + year
}

addDoc(newUserRequest, newUser);
Expand Down

0 comments on commit 858cfb7

Please sign in to comment.