Shun Miyazawa 3 năm trước cách đây
mục cha
commit
d88abd1489

+ 1 - 16
packages/app/src/components/Admin/AuditLog/DateRangePicker.tsx

@@ -1,11 +1,8 @@
 import React, { FC, useRef, forwardRef } from 'react';
 
-import { ja, enUS, zhCN } from 'date-fns/locale';
-import DatePicker, { registerLocale } from 'react-datepicker';
+import DatePicker from 'react-datepicker';
 import 'react-datepicker/dist/react-datepicker.css';
 
-import { useCurrentUser } from '~/stores/context';
-
 
 type CustomInputProps = {
   buttonRef: React.Ref<HTMLButtonElement>
@@ -26,12 +23,6 @@ const CustomInput = forwardRef<HTMLButtonElement, CustomInputProps>((props: Cust
 });
 
 
-const DateFnslocal = {
-  ja_JP: ['ja', ja],
-  en_US: ['enUS', enUS],
-  zh_CN: ['zhCN', zhCN],
-} as const;
-
 type DateRangePickerProps = {
   startDate: Date | null
   endDate: Date | null
@@ -41,17 +32,11 @@ type DateRangePickerProps = {
 export const DateRangePicker: FC<DateRangePickerProps> = (props: DateRangePickerProps) => {
   const { startDate, endDate } = props;
 
-  const { data: currentUser } = useCurrentUser();
-  const currentUserLang = currentUser != null ? currentUser.lang : 'en_US';
-  const dateFnslocal = DateFnslocal[currentUserLang];
-  registerLocale(dateFnslocal[0], dateFnslocal[1]);
-
   const buttonRef = useRef(null);
 
   return (
     <div className="btn-group mr-2 mb-3">
       <DatePicker
-        locale={dateFnslocal[0]}
         selectsRange
         startDate={startDate}
         endDate={endDate}

+ 0 - 2
packages/app/src/interfaces/user.ts

@@ -1,6 +1,5 @@
 import { Ref } from './common';
 import { HasObjectId } from './has-object-id';
-import { Lang } from './lang';
 
 export type IUser = {
   name: string;
@@ -9,7 +8,6 @@ export type IUser = {
   password: string;
   imageUrlCached: string;
   admin: boolean;
-  lang: Lang;
 }
 
 export type IUserGroupRelation = {