dream-num / univer

Univer is an open-source productivity tool dev kit helping you integrate spreadsheets, docs and slides into your applications.
https://univer.ai
Apache License 2.0
6.58k stars 561 forks source link

[Feature] Discussion on automatic conversion of input date content into digital format #1313

Open Dushusir opened 7 months ago

Dushusir commented 7 months ago

初始清单

问题

输入 2020-1-1, univer 会识别为日期格式,但是展示仍然是 2020-1-1, 输入 2020-01-01, univer 会识别为日期格式,但是展示仍然是 2020-01-01, 输入 2020/01/01, univer 会识别为日期格式,但是展示仍然是 2020/01/01,

解决方案

输入 2020-1-1, excel 会变成 2020/1/1 输入 2020-01-01, excel 会变成 2020/1/1 输入 2020/01/01, excel 会变成 2020/1/1

更多思考

类似 "2020年1月1日" 也会识别为日期,这就要考虑国际化问题

Dushusir commented 7 months ago

@zhaolixin7 @Ella1117 需要一些调研,看是否匹配excel

Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@zhaolixin7 @Ella1117 Need some research to see if it matches excel

Dushusir commented 7 months ago

/- 的格式差异,解析时间的时候在不同浏览器上也不同表现,可以参考 https://segmentfault.com/a/1190000022403847

或许可以降低出错概率

Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The format difference between / and - will also behave differently in different browsers when parsing the time. Please refer to https://segmentfault.com/a/1190000022403847. Perhaps the probability of error can be avoided

univer-bot[bot] commented 6 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Feature] 关于输入日期内容自动转化数字格式的讨论

Title: [Feature] Discussion on automatic conversion of input date content into digital format


Initial list

question

Enter 2020-1-1, univer will recognize it as a date format, but the display will still be 2020-1-1, Enter 2020-01-01, univer will recognize it as a date format, but the display will still be 2020-01-01, Enter 2020/01/01, univer will recognize it as a date format, but the display will still be 2020/01/01,

solution

Enter 2020-1-1, excel will become 2020/1/1 Enter 2020-01-01, excel will become 2020/1/1 Enter 2020/01/01, excel will become 2020/1/1

More Thoughts

Something like "January 1, 2020" will also be recognized as a date, which requires internationalization issues to be considered.