Remove unused locale helpers (#39959)
Co-authored-by: Kit Langton <kit.langton@gmail.com>
This commit is contained in:
parent
4569659b03
commit
eab59ea021
1 changed files with 0 additions and 18 deletions
|
|
@ -16,19 +16,6 @@ export function datetime(input: number): string {
|
||||||
return `${localTime} · ${localDate}`
|
return `${localTime} · ${localDate}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function todayTimeOrDateTime(input: number): string {
|
|
||||||
const date = new Date(input)
|
|
||||||
const now = new Date()
|
|
||||||
const isToday =
|
|
||||||
date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate()
|
|
||||||
|
|
||||||
if (isToday) {
|
|
||||||
return time(input)
|
|
||||||
} else {
|
|
||||||
return datetime(input)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function number(num: number): string {
|
export function number(num: number): string {
|
||||||
if (num >= 1000000) {
|
if (num >= 1000000) {
|
||||||
return (num / 1000000).toFixed(1) + "M"
|
return (num / 1000000).toFixed(1) + "M"
|
||||||
|
|
@ -108,9 +95,4 @@ export function truncateMiddle(str: string, maxLength: number = 35): string {
|
||||||
return str.slice(0, keepStart) + ellipsis + str.slice(-keepEnd)
|
return str.slice(0, keepStart) + ellipsis + str.slice(-keepEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pluralize(count: number, singular: string, plural: string): string {
|
|
||||||
const template = count === 1 ? singular : plural
|
|
||||||
return template.replace("{}", count.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
export * as Locale from "./locale"
|
export * as Locale from "./locale"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue