From 5d7767dfea9fdb94aaf039d85bd2bedd5ec39872 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Tue, 14 Dec 2021 19:11:24 +0100 Subject: [PATCH] [bug] fix saving datepicker value unchanged --- routes/profileEditor.vue | 2 +- src/birthdate.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/routes/profileEditor.vue b/routes/profileEditor.vue index 7cb821c66..db18adb85 100644 --- a/routes/profileEditor.vue +++ b/routes/profileEditor.vue @@ -322,7 +322,7 @@ names: listToDict(this.names), pronouns: listToDict(this.pronouns), description: this.description, - birthday: this.birthday ? formatDate(this.birthday) : null, + birthday: formatDate(this.birthday), links: [...this.links], flags: [...this.flags], customFlags: {...this.customFlags}, diff --git a/src/birthdate.js b/src/birthdate.js index 51c2de1e9..3995e392e 100644 --- a/src/birthdate.js +++ b/src/birthdate.js @@ -6,6 +6,8 @@ module.exports = { minBirthdate, maxBirthdate, formatDate(bd) { + if (!bd) { return null; } + if (typeof(bd) === 'string') { return bd; } return `${bd.getFullYear()}-${('0' + (bd.getMonth() + 1)).slice(-2)}-${('0' + bd.getDate()).slice(-2)}`; }, parseDate(bd) {