Added compact translations for date duration
This commit is contained in:
@@ -496,12 +496,24 @@ export const useCalendar = defineStore("calendar", () => {
|
||||
years: "xYearsNext",
|
||||
yearsAndMonths: "xYearsAndMonthsNext",
|
||||
}
|
||||
const futureKeysCompact: DateDirectionTranslationKeys = {
|
||||
days: "xDaysNextCompact",
|
||||
months: "xMonthsNextCompact",
|
||||
years: "xYearsNextCompact",
|
||||
yearsAndMonths: "xYearsAndMonthsNextCompact",
|
||||
}
|
||||
const pastKeys: DateDirectionTranslationKeys = {
|
||||
days: "xDaysAgo",
|
||||
months: "xMonthsAgo",
|
||||
years: "xYearsAgo",
|
||||
yearsAndMonths: "xYearsAndMonthsAgo",
|
||||
}
|
||||
const pastKeysCompact: DateDirectionTranslationKeys = {
|
||||
days: "xDaysAgoCompact",
|
||||
months: "xMonthsAgoCompact",
|
||||
years: "xYearsAgoCompact",
|
||||
yearsAndMonths: "xYearsAndMonthsAgoCompact",
|
||||
}
|
||||
let directionKeys: DateDirectionTranslationKeys = pastKeys
|
||||
|
||||
// Check whether it's a past or future date
|
||||
@@ -535,6 +547,13 @@ export const useCalendar = defineStore("calendar", () => {
|
||||
} else {
|
||||
directionKeys = pastKeys
|
||||
}
|
||||
} else {
|
||||
// Get relevant prefix for the string (without the prefix)
|
||||
if (direction === "future") {
|
||||
directionKeys = futureKeysCompact
|
||||
} else {
|
||||
directionKeys = pastKeysCompact
|
||||
}
|
||||
}
|
||||
|
||||
const isSameMonth = baseDate.month === relativeDate.month
|
||||
|
||||
Reference in New Issue
Block a user