import React from "react";
import { ConfigProvider as AntdConfigProvider, ConfigProviderProps } from "antd";
import enUS from 'antd/locale/en_US';
import zhCN from 'antd/locale/zh_CN';
import dayUS from 'dayjs/locale/zh-cn';
import dayCN from 'dayjs/locale/en';
import { locale } from 'dayjs';

export const ConfigProvider = (props: ConfigProviderProps) => {
  if (props.locale === enUS) {
    locale(dayUS);
  } else {
    locale(dayCN);
  }
  return <AntdConfigProvider locale={zhCN} {...props} />;
};
