mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 12:01:52 -07:00
Added KOITO_DATE_FORMAT option to choose how the dates are displayed
This commit is contained in:
parent
0ec7b458cc
commit
61d5f2f5f0
10 changed files with 53 additions and 9 deletions
|
|
@ -52,7 +52,15 @@ function timeSince(date: Date) {
|
|||
return "just now";
|
||||
}
|
||||
|
||||
export { timeSince };
|
||||
function formatDate(date: Date, format: string): string {
|
||||
if (!format) return date.toLocaleDateString();
|
||||
const dd = String(date.getDate()).padStart(2, "0");
|
||||
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const yyyy = String(date.getFullYear());
|
||||
return format.replace("DD", dd).replace("MM", mm).replace("YYYY", yyyy);
|
||||
}
|
||||
|
||||
export { timeSince, formatDate };
|
||||
|
||||
type hsl = {
|
||||
h: number;
|
||||
|
|
@ -119,3 +127,4 @@ const timeListenedString = (seconds: number) => {
|
|||
|
||||
export { hexToHSL, timeListenedString, getRewindYear, getRewindParams };
|
||||
export type { hsl };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue