Merge pull request #19 from AlexisNP/register_date

- Implemented register date for users
This commit is contained in:
AlexisNP
2020-12-24 18:09:41 +01:00
committed by GitHub
3 changed files with 15 additions and 2 deletions

View File

@@ -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,

View File

@@ -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'

View File

@@ -13,6 +13,7 @@
<i class="mad">check_circle</i>
</span>
</h2>
<span>Membre depuis le {{ registered_date }}</span>
</div>
</template>
@@ -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);
}
}
}