Skip to content

Commit

Permalink
feat: completed moment to dayjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Apr 13, 2022
1 parent 92d2abe commit 743fba8
Show file tree
Hide file tree
Showing 12 changed files with 1,046 additions and 22 deletions.
48 changes: 48 additions & 0 deletions playground/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* eslint-disable no-console */
import React, { useState } from 'react'
import { Calendar, ConfigProvider, DatePicker, Select } from 'antd'
import 'antd/dist/antd.variable.css'
import enUS from 'antd/es/locale/en_US'
import zhCN from 'antd/es/locale/zh_CN'
import 'moment/locale/zh-cn'

const onChange = (value: any) => {
console.log('🚀 ~ onChange value: ', value)
}

const App = () => {
const [locale, setLocale] = useState<string>('en_US')

return <div style={{
display: 'flex',
flexDirection: 'column',
gap: '12px',
}}>
<ConfigProvider locale={locale === 'zh_CN' ? zhCN : enUS}>
<Select
value={locale}
onChange={setLocale}
options={[
{
label: '🇨🇳 中文',
value: 'zh_CN',
},
{
label: '🇺🇸 English',
value: 'en_US',
},
]}>

</Select>
<DatePicker onChange={onChange} />
<DatePicker.MonthPicker onChange={onChange} />
<DatePicker.QuarterPicker onChange={onChange} />
<DatePicker.RangePicker onChange={onChange} />
<DatePicker.WeekPicker onChange={onChange} />
<DatePicker.YearPicker onChange={onChange} />
<Calendar onChange={onChange} ></Calendar>
</ConfigProvider>
</div>
}

export default App
4 changes: 2 additions & 2 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="app"></div>
<div id="root"></div>
<a href="/__inspect/module?id=./main.ts&index=2" target="_blank" style="text-decoration: none; margin-top:10px; display: block;">visit /__inspect/ to inspect the intermediate state</a>
<script type="module" src="./main.ts"></script>
<script type="module" src="./main.tsx"></script>
</body>
</html>
1 change: 0 additions & 1 deletion playground/main.ts

This file was deleted.

10 changes: 10 additions & 0 deletions playground/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
)
10 changes: 10 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
"scripts": {
"dev": "nodemon -w '../src/**/*.ts' -e .ts -x 'vite'"
},
"dependencies": {
"antd": "^4.19.5",
"moment": "latest",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react": "^1.3.0",
"dayjs": "^1.11.0",
"vite": "^2.9.1",
"vite-plugin-inspect": "^0.4.3"
}
Expand Down
2 changes: 2 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { defineConfig } from 'vite'
import Inspect from 'vite-plugin-inspect'
import react from '@vitejs/plugin-react'
import Unplugin from '../src/vite'

export default defineConfig({
plugins: [
Inspect(),
react(),
Unplugin(),
],
})
Loading

0 comments on commit 743fba8

Please sign in to comment.