Comments (11)
复现地址404...
from ant-design.
@Wxh16144 可能是权限问题,你直接访问仓库吧
https://github.com/faner11/procomponents-dayjs
from ant-design.
感觉像 dayjs 的 bug 🤔
import dayjs from 'dayjs'
import advancedFormat from 'dayjs/plugin/advancedFormat'
import weekOfYear from 'dayjs/plugin/weekOfYear'
import weekYear from 'dayjs/plugin/weekYear'
dayjs.extend(weekOfYear)
dayjs.extend(weekYear)
dayjs.extend(advancedFormat)
dayjs('2024-02', 'gggg-ww', true).format('YYYY-MM-DD HH:mm:ss') // Invalid Date
from ant-design.
感觉像 dayjs 的 bug 🤔
估计和 #43246 (comment) 问题一样,不支持反向 format ...
CC. @iamkun
from ant-design.
@Wxh16144 我和你使用了同样的代码,我是正常的
import dayjs from 'dayjs';
import advancedFormat from 'dayjs/plugin/advancedFormat'
import weekOfYear from 'dayjs/plugin/weekOfYear'
import weekYear from 'dayjs/plugin/weekYear'
dayjs.extend(weekOfYear)
dayjs.extend(weekYear)
dayjs.extend(advancedFormat)
console.log(dayjs("2024-02","gggg-ww",true).format("YYYY-MM-DD HH:mm:ss")); // 2024-02-01 00:00:00
from ant-design.
dayjs 需要使用 WeekOfYear 插件才能支持 ww
格式。你在不使用 antd 组件的时候,相当于没有配置插件状态。dayjs 对于不支持的格式会进行模糊匹配,然后把 ww
当成月份转换(你的代码中 2024-02
并没有正确转换成对应的时间)。
在 antd 中,当你使用组件会被引入 WeekOfYear 插件,所以它会按照 ww
来匹配。但是由于 dayjs 又不支持 ww
解析。所以被降级成了当前时间。
这就相当于两个都是错的,我希望错的更一致一些一样。是没有意义的。可以考虑给 dayjs 提 issue 来支持这个能力哈~
from ant-design.
@zombieJ 我使用了 weekOfYear 插件,解析依然正常,但是使用Antd 组件就 返回 Invalid Date。问题没解决你别关闭呀
from ant-design.
我使用了 weekOfYear 插件,解析依然正常
你是指 dayjs().format('gggg-ww')
这样的用法正确么?
from ant-design.
dayjs().format('gggg-ww') 无论是否使用Antd 都是正确的
出问题的是 dayjs("2024-02","gggg-ww",true).format("YYYY-MM-DD HH:mm:ss")
from ant-design.
@zombieJ 我使用了 weekOfYear 插件,解析依然正常,但是使用Antd 组件就 返回 Invalid Date。问题没解决你别关闭呀
2024-02
按照 gggg-ww
解析出来的时间怎么可能是 2024-02-01
,你设置的格式是 周 不是 月。2024-02
按照周格式解析出来是 2024-01-08
~ 2024-01-14
这个时间段。
再看一下我的描述?~
from ant-design.
@zombieJ 对哦,没注意,时间也是错的
from ant-design.
Related Issues (20)
- 官网 breadcrumb 部分demo加载失败 bug HOT 8
- Neutral Color Palette missing HOT 1
- Three way switch or switches with dynamic number of values HOT 3
- <StyleProvider layer /> messageApi.success() 等提示的图标颜色被覆盖 HOT 2
- Problem with hiding options and showing `notFoundContent` in Select "tags" mode
- [Input]chrome浏览器上微软中文输入法输入123,4会自动变成123,44被多加了一位(可能是对value格式化引起的) HOT 3
- rc-virtual-list horizontal scroll bug, very fast scrolling HOT 1
- 自定义全局组件的 Empty 样式后,Table的过滤面板没生效 HOT 6
- Badge has insufficient color contrast HOT 3
- 使用谷歌浏览器的插件DARK READER的暗黑模式,ant-design的网站会报错打不开 HOT 2
- Incorrect decimal formatting/parsing in InputNumber component HOT 3
- Table组件的中当数据源中存在BigInt数据类型时,无法渲染此类型的Bug HOT 7
- Modal Close Button aria-label Not Correctly Translated for "de" Locale HOT 3
- tags导航 布局bug HOT 6
- Dynamic row adjustment HOT 3
- 执行ant-design的代码,vscode终端没有报错,但是没有办法加载出来,就算把自己新加的代码注释了,也是没办法加载出来 HOT 4
- a-table希望能添加虚拟纵向滚动条-方便查看数据。 HOT 2
- 3.x Table' cell not align properly HOT 5
- Tabel 组件的固定表头,scroll属性无法设置y:‘auto’ HOT 2
- [Table] 支持移除 tbody 的 padding 并设置高度撑满
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-design.