Skip to content

Commit

Permalink
fix: email dob timestamp
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Coufal <coufal.tom@gmail.com>
  • Loading branch information
tumido committed May 31, 2022
1 parent 952c38f commit 07125a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const transporter = nodemailer.createTransport({
type Registration = {
address: string
allergies: string
dob: admin.firestore.Timestamp
dob: admin.firestore.Timestamp | string
email: string
insurance: string
name: string
Expand All @@ -48,6 +48,10 @@ exports.onRegistration = functions.firestore
.onCreate(async (snap, context) => {
const data = snap.data() as Registration

data.dob = (data.dob as admin.firestore.Timestamp)
.toDate()
.toLocaleDateString('cs-CZ')

const messages = [
{
type: 'player',
Expand Down

0 comments on commit 07125a9

Please sign in to comment.