forked from akai/readest
77a85cee09
Adds a row beneath the translation characters bar on the user profile page with "X% used" (start) and "Resets in H hr m min" (end). The countdown points to the next UTC midnight, matching the server-side daily-usage key in UsageStatsManager. Formatting goes through the dayjs duration plugin and ticks every minute while the page is open. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
37 lines
917 B
TypeScript
37 lines
917 B
TypeScript
import dayjs from 'dayjs';
|
|
import duration from 'dayjs/plugin/duration';
|
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
|
|
dayjs.extend(duration);
|
|
|
|
import 'dayjs/locale/en';
|
|
import 'dayjs/locale/zh';
|
|
import 'dayjs/locale/de';
|
|
import 'dayjs/locale/ja';
|
|
import 'dayjs/locale/ko';
|
|
import 'dayjs/locale/ru';
|
|
import 'dayjs/locale/fr';
|
|
import 'dayjs/locale/el';
|
|
import 'dayjs/locale/es';
|
|
import 'dayjs/locale/it';
|
|
import 'dayjs/locale/pt';
|
|
import 'dayjs/locale/pt-br';
|
|
import 'dayjs/locale/ar';
|
|
import 'dayjs/locale/id';
|
|
import 'dayjs/locale/hi';
|
|
import 'dayjs/locale/th';
|
|
import 'dayjs/locale/tr';
|
|
import 'dayjs/locale/vi';
|
|
import 'dayjs/locale/uk';
|
|
import 'dayjs/locale/pl';
|
|
import 'dayjs/locale/fi';
|
|
import 'dayjs/locale/nl';
|
|
import 'dayjs/locale/ro';
|
|
import 'dayjs/locale/zh-tw';
|
|
import 'dayjs/locale/zh-cn';
|
|
|
|
export const initDayjs = (locale: string) => {
|
|
dayjs.locale(locale);
|
|
dayjs.extend(relativeTime);
|
|
};
|