GoonCord/src/core/fixes.ts

17 lines
528 B
TypeScript
Raw Normal View History

2023-03-07 23:12:41 +00:00
import { FluxDispatcher, moment } from "@metro/common";
import logger from "@lib/utils/logger";
2023-03-07 23:12:41 +00:00
function onDispatch({ locale }: { locale: string }) {
// Timestamps
try {
// TODO: Test if this works with all locales
moment.locale(locale.toLowerCase());
} catch(e) {
logger.error("Failed to fix timestamps...", e);
}
// We're done here!
2023-03-08 20:49:41 +00:00
FluxDispatcher.unsubscribe("I18N_LOAD_SUCCESS", onDispatch);
2023-03-07 23:12:41 +00:00
}
2023-03-08 20:49:41 +00:00
export default () => FluxDispatcher.subscribe("I18N_LOAD_SUCCESS", onDispatch);