1.0.1 • Published 2 years ago

@wry-smile/vite-plugin-antd-use-dayjs v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

vite-plugin-antd-use-dayjs

react antd library use dayjs

replace Moment with Dayjs in antd project

Usage 使用方法

  1. npm i dayjs
  2. npm i @wry-smile/vite-plugin-antd-use-dayjs

Example 示例

// In vite.config.ts
import { vitePluginAntdUseDayjs } from '@wry-smile/vite-plugin-antd-use-dayjs'

export default defineConfig({
  plugins: [
    // default locale zh-cn
    vitePluginAntdUseDayjs.vite(),

    // or
    vitePluginAntdUseDayjs.vite({
      locale: 'en',
    }),

    // or Turn off automatic plugin localization
    vitePluginAntdUseDayjs.vite({
      defaultLocale: false
    })
  ],
})
// If you set defaultLocale to false, you can do locale in Main.tsx
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')