Skip to content
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

日期显示错误 #18

Closed
lzq-hopego opened this issue May 9, 2024 · 1 comment
Closed

日期显示错误 #18

lzq-hopego opened this issue May 9, 2024 · 1 comment

Comments

@lzq-hopego
Copy link

关于日期显示错误的问题

描述: 未设置这学期的开始时间,假如今天是5月9日今天周四,但是显示的日期却是五月9日是当前周的周一,看到代码就是从今天开始(当作周一)循环6此展示周二至周日的日期,这样会导致9+3才是周四(也就是今天) 但是日期错误了,也可能是我这个设备有问题,但是修改之后在其他设备是对的,所以将src/stores/course.ts中的第120行更改为下面的代码块,以修正显示错误,当前日期减去当前是周几再加1则是本周的周一的正确日期

someDate.setDate(someDate.getDate() + weekIndex * 7-(someDate.getDay() || 7)+1)
  • 显示错误如下图所示
    image

但是当我修复了之后,再填了这学期的开始时间,每周几下对应的日期都是对的,并且再将我修复的代码还原成原来的,显示正常,但是一旦去掉学期的开始时间就会继续出现上述的问题(使用我修改后的代码仍然显示正常),我对于vue前端不太熟悉,请问一下这样修改从长久来看有没有问题?

  • 也是非常感谢作者写出的这么漂亮的界面
@zguolee
Copy link
Owner

zguolee commented May 16, 2024

应该没问题吧,好久之前的代码了😂

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

No branches or pull requests

2 participants