diff --git a/client/src/components/Summoner/RecentActivity.vue b/client/src/components/Summoner/RecentActivity.vue index 63b7de6..1bd9669 100644 --- a/client/src/components/Summoner/RecentActivity.vue +++ b/client/src/components/Summoner/RecentActivity.vue @@ -102,7 +102,7 @@ export default { for (let i = 1; i <= nbDaysInGrid; i++) { const day = new Date() day.setDate(day.getDate() - nbDaysInGrid + i) - const formattedDay = day.toLocaleString('fr', this.options) + const formattedDay = day.toLocaleString(undefined, this.options) this.gridDays.push({ date: formattedDay, @@ -119,7 +119,7 @@ export default { for (const key in this.matches) { const match = this.matches[key] const matchTime = new Date(match.timestamp) - const formattedTime = matchTime.toLocaleString('fr', this.options) + const formattedTime = matchTime.toLocaleString(undefined, this.options) const dayOfTheMatch = this.gridDays.filter( e => e.date === formattedTime diff --git a/client/src/helpers/functions.js b/client/src/helpers/functions.js index ed9aaff..98a810b 100644 --- a/client/src/helpers/functions.js +++ b/client/src/helpers/functions.js @@ -19,9 +19,7 @@ export function timeDifference(previous) { } else if (elapsed < msPerWeek) { return Math.round(elapsed / msPerDay) + ' days ago' } else { - const oldDate = new Date(previous) - const day = oldDate.getDate() < 10 ? '0' + oldDate.getDate() : oldDate.getDate() - const month = oldDate.getMonth() < 9 ? '0' + (oldDate.getMonth() + 1) : (oldDate.getMonth() + 1) - return day + '.' + month + '.' + oldDate.getFullYear().toString().substr(-2) + const dateOptions = { day: '2-digit', month: '2-digit', year: 'numeric' } + return new Date(previous).toLocaleString(undefined, dateOptions).replace(/\//g, '.') } } diff --git a/client/src/helpers/summoner.js b/client/src/helpers/summoner.js index 83c59fa..c7e5b79 100644 --- a/client/src/helpers/summoner.js +++ b/client/src/helpers/summoner.js @@ -16,7 +16,7 @@ export function createMatchData(matches) { const date = new Date(match.date) const dateOptions = { day: '2-digit', month: '2-digit', year: 'numeric' } const timeOptions = { hour12: false, hour: '2-digit', minute: '2-digit' } - match.fullDate = { date: date.toLocaleString('fr', dateOptions), time: date.toLocaleString('fr', timeOptions) } + match.fullDate = { date: date.toLocaleString(undefined, dateOptions), time: date.toLocaleString(undefined, timeOptions) } match.date = timeDifference(match.date) match.map = maps[match.map]