Skip to content

[calendar] wxs 中,getDateByTimestamp判断月份有误 #3441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leehave opened this issue Jan 12, 2025 · 1 comment · Fixed by #3442
Closed

[calendar] wxs 中,getDateByTimestamp判断月份有误 #3441

leehave opened this issue Jan 12, 2025 · 1 comment · Fixed by #3442

Comments

@leehave
Copy link

leehave commented Jan 12, 2025

tdesign-miniprogram 版本

1.8.4

重现链接

https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/calendar/_example/calendar.wxs#L3

重现步骤

有问题的代码片段
function getDateByTimestamp(val) {
var date = getDate(val);
return [date.getFullYear(), date.getMonth() < 10 ? '0' + ( date.getMonth() + 1) : date.getMonth() + 1, date.getDate() < 10 ? '0' + date.getDate() : date.getDate()].join('-');
}

期望结果

选择 2024 年 10 月中一天,预期展示正常,2024-10-01

实际结果

选择 2024 年 10 月中一天,预期展示正常,2024-010-01

基础库版本

No response

补充说明

function getDateByTimestamp(val) {
var date = getDate(val);
return [date.getFullYear(), date.getMonth() + 1 < 10 ? '0' + ( date.getMonth() + 1) : date.getMonth() + 1, date.getDate() < 10 ? '0' + date.getDate() : date.getDate()].join('-');
}

Copy link
Contributor

👋 @leehave,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant