From 01df57f510ec4f4363424385aa045f02fdaedd96 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Thu, 24 Dec 2020 17:55:32 +0100 Subject: [PATCH] - Implemented register date for users --- api/database/auracle_db_create.sql | 1 + client/src/main.js | 4 ++-- client/src/pages/user/profile-page.vue | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/database/auracle_db_create.sql b/api/database/auracle_db_create.sql index 1809d37..acbfada 100644 --- a/api/database/auracle_db_create.sql +++ b/api/database/auracle_db_create.sql @@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `mail` VARCHAR(255) NOT NULL, `avatar` VARCHAR(255), `gender` VARCHAR(255), + `register_date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `password` VARCHAR(255) NOT NULL, `role_id` INT UNSIGNED NOT NULL DEFAULT 1, `verified` BOOLEAN DEFAULT false, diff --git a/client/src/main.js b/client/src/main.js index e90e995..8dac402 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -43,14 +43,14 @@ import clipboard from 'v-clipboard' Vue.use(clipboard) // FUNCTIONS -var filter = function(text, length, clamp){ +var filter = (text, length, clamp) => { clamp = clamp || '...'; var node = document.createElement('div'); node.innerHTML = text; var content = node.textContent; return content.length > length ? content.slice(0, length) + clamp : content; } -Vue.filter('truncate', filter) +Vue.filter('truncate', filter); // Router import router from './routes' diff --git a/client/src/pages/user/profile-page.vue b/client/src/pages/user/profile-page.vue index be7234f..7fe7be5 100644 --- a/client/src/pages/user/profile-page.vue +++ b/client/src/pages/user/profile-page.vue @@ -13,6 +13,7 @@ check_circle + Membre depuis le {{ registered_date }} @@ -28,6 +29,17 @@ export default { computed: { user() { return this.$store.getters.getUserProfile + }, + registered_date() { + let raw_date = new Date(this.user.register_date); + + let date_options = { + day: 'numeric', + month: 'long', + year: 'numeric', + }; + + return new Intl.DateTimeFormat("fr", date_options).format(raw_date); } } }