Browse Source

Shorten year for chat list dates

master
morethanwords 4 years ago
parent
commit
67a1c4734c
  1. 2
      src/helpers/date.ts

2
src/helpers/date.ts

@ -21,7 +21,7 @@ export const formatDateAccordingToToday = (time: Date) => {
if((now - timestamp) < ONE_DAY && date.getDate() == time.getDate()) { // if the same day if((now - timestamp) < ONE_DAY && date.getDate() == time.getDate()) { // if the same day
timeStr = ('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2); timeStr = ('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2);
} else if(date.getFullYear() != time.getFullYear()) { // different year } else if(date.getFullYear() != time.getFullYear()) { // different year
timeStr = time.getDate() + '.' + (time.getMonth() + 1) + '.' + time.getFullYear(); timeStr = time.getDate() + '.' + (time.getMonth() + 1) + '.' + ('' + time.getFullYear()).slice(-2);
} else if((now - timestamp) < (ONE_DAY * 7) && getWeekNumber(date) == getWeekNumber(time)) { // current week } else if((now - timestamp) < (ONE_DAY * 7) && getWeekNumber(date) == getWeekNumber(time)) { // current week
timeStr = days[time.getDay()].slice(0, 3); timeStr = days[time.getDay()].slice(0, 3);
} else { // same year } else { // same year

Loading…
Cancel
Save