Clean internal_time_ago

This commit is contained in:
PascalMarchesseault
2024-09-02 20:16:23 -04:00
parent 4c316a68da
commit e3c627a324

View File

@@ -23,52 +23,28 @@ function internal_time_ago(time) {
}
const {t} = useI18n();
const I18nseconds = t('time.seconds');
const I18nminuteago = t('time.1minuteago');
const I181minutefromnow = t('time.1minutefromnow');
const I181minutes = t('time.minutes');
const I1811hourago = t('time.1hourago');
const I1811hourfromnow = t('time.1hourfromnow');
const I18n1hours = t('time.hours');
const I18nyesterday = t('time.yesterday');
const I18ntomorrow = t('time.tomorrow');
const I18ndays = t('time.days');
const I18nlastweek = t('time.lastweek');
const I18nnextweek = t('time.nextweek');
const I18nweeks = t('time.weeks');
const I18nlastmonth = t('time.lastmonth');
const I18nnextmonth = t('time.nextmonth');
const I18nmonths = t('time.months');
const I18nlastyear = t('time.lastyear');
const I18nnextyear = t('time.nextyear');
const I18nyears = t('time.years');
const I18nlastcentury = t('time.lastcentury');
const I18nnextcentury = t('time.nextcentury');
const I18ncenturies = t('time.centuries');
const I18nago = t('time.ago');
const time_formats = [
[60, I18nseconds, 1], // 60
[120, I18nminuteago, I181minutefromnow], // 60*2
[3600, I181minutes, 60], // 60*60, 60
[7200, I1811hourago, I1811hourfromnow], // 60*60*2
[86400, I18n1hours, 3600], // 60*60*24, 60*60
[172800, I18nyesterday, I18ntomorrow], // 60*60*24*2
[604800, I18ndays, 86400], // 60*60*24*7, 60*60*24
[1209600, I18nlastweek, I18nnextweek], // 60*60*24*7*4*2
[2419200, I18nweeks, 604800], // 60*60*24*7*4, 60*60*24*7
[4838400, I18nlastmonth, I18nnextmonth], // 60*60*24*7*4*2
[29030400, I18nmonths, 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
[58060800, I18nlastyear, I18nnextyear], // 60*60*24*7*4*12*2
[2903040000, I18nyears, 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
[5806080000, I18nlastcentury, I18nnextcentury], // 60*60*24*7*4*12*100*2
[58060800000, I18ncenturies, 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
[60, t('time.seconds'), 1], // 60
[120, t('time.1minuteago'), t('time.1minutefromnow')], // 60*2
[3600, t('time.minutes'), 60], // 60*60, 60
[7200, t('time.1hourago'), t('time.1hourfromnow')], // 60*60*2
[86400, t('time.hours'), 3600], // 60*60*24, 60*60
[172800, t('time.yesterday'), t('time.tomorrow')], // 60*60*24*2
[604800, t('time.days'), 86400], // 60*60*24*7, 60*60*24
[1209600, t('time.lastweek'), t('time.nextweek')], // 60*60*24*7*4*2
[2419200, t('time.weeks'), 604800], // 60*60*24*7*4, 60*60*24*7
[4838400, t('time.lastmonth'), t('time.nextmonth')], // 60*60*24*7*4*2
[29030400, t('time.months'), 2419200], // 60*60*24*7*4*12, 60*60*24*7*4
[58060800, t('time.lastyear'), t('time.nextyear')], // 60*60*24*7*4*12*2
[2903040000, t('time.years'), 29030400], // 60*60*24*7*4*12*100, 60*60*24*7*4*12
[5806080000, t('time.lastcentury'), t('time.nextcentury')], // 60*60*24*7*4*12*100*2
[58060800000, t('time.centuries'), 2903040000] // 60*60*24*7*4*12*100*20, 60*60*24*7*4*12*100
];
let seconds = time / 1000
let token = I18nago
let token = t('time.ago')
let list_choice = 1
if (seconds === 0) {