modified: serv_nginx/bbvue/src/views/Profile.vue
Fix bag with the not correct date on Profile page. Begushiybashkir.ru site
This commit is contained in:
@@ -247,30 +247,48 @@ export default {
|
||||
return baseUrl + filename;
|
||||
},
|
||||
joinDate() {
|
||||
// Добавим отладку для всего объекта user
|
||||
console.log('DEBUG - user object:', this.user);
|
||||
console.log('DEBUG - user keys:', this.user ? Object.keys(this.user) : 'no user');
|
||||
|
||||
if (!this.user?.createdAt) {
|
||||
console.log('DEBUG - createdAt is missing or falsy');
|
||||
if (!this.user?.created_at) {
|
||||
return 'Неизвестно';
|
||||
}
|
||||
if (!this.user?.createdAt) return 'Неизвестно';
|
||||
|
||||
console.log('DEBUG - createdAt:', this.user.createdAt, 'Type:', typeof this.user.createdAt);
|
||||
console.log('DEBUG - created_at:', this.user.created_at, 'Type:', typeof this.user.created_at);
|
||||
|
||||
// Пробуем разные форматы даты
|
||||
let date;
|
||||
if (this.user.created_at.includes('T')) {
|
||||
// ISO формат
|
||||
date = new Date(this.user.created_at);
|
||||
} else {
|
||||
// Другие форматы
|
||||
date = new Date(this.user.created_at.replace(' ', 'T'));
|
||||
}
|
||||
|
||||
// Пробуем просто создать дату
|
||||
const date = new Date(this.user.createdAt);
|
||||
console.log('DEBUG - parsed date:', date);
|
||||
|
||||
if (isNaN(date.getTime())) {
|
||||
// Если все еще ошибка, пробуем убрать микросекунды
|
||||
const cleanDate = this.user.created_at.split('.')[0];
|
||||
date = new Date(cleanDate);
|
||||
|
||||
if (isNaN(date.getTime())) {
|
||||
return 'Неизвестно';
|
||||
}
|
||||
}
|
||||
|
||||
const month = date.toLocaleString('ru-RU', { month: 'long' });
|
||||
const year = date.getFullYear();
|
||||
|
||||
return `${month} ${year}`;
|
||||
// Склоняем месяц
|
||||
const monthNames = {
|
||||
'январь': 'января', 'февраль': 'февраля', 'март': 'марта',
|
||||
'апрель': 'апреля', 'май': 'мая', 'июнь': 'июня',
|
||||
'июль': 'июля', 'август': 'августа', 'сентябрь': 'сентября',
|
||||
'октябрь': 'октября', 'ноябрь': 'ноября', 'декабрь': 'декабря'
|
||||
};
|
||||
|
||||
const monthName = monthNames[month] || month;
|
||||
|
||||
return `${monthName} ${year}`;
|
||||
},
|
||||
experienceLabel() {
|
||||
const experienceMap = {
|
||||
|
||||
Reference in New Issue
Block a user