Skip to content

Conversation

Copy link

Copilot AI commented Oct 30, 2025

  • Refactor utils/learning-center/date.ts to use dayjs
  • Refactor utils/learning-center/history-appointment-status.ts to use dayjs
  • Refactor components/course/course-week.tsx to use dayjs
  • Refactor components/course/time-col.tsx to use dayjs
  • Refactor lib/course.ts toLocaleString() calls to use dayjs
  • Refactor lib/locate-date.ts to use dayjs
  • Refactor app/(guest)/index.tsx toDateString() to use dayjs
  • Refactor app/toolbox/exam-room.tsx to use dayjs
  • Refactor app/toolbox/learning-center/time-select.tsx to use dayjs
  • Refactor app/toolbox/learning-center/qr-scanner.tsx to use dayjs
  • Refactor app/toolbox/academic/unified-exam.tsx to use dayjs
  • Refactor app/toolbox/academic/grades.tsx to use dayjs
  • Refactor app/toolbox/academic/credits.tsx to use dayjs
  • Refactor app/common/about.tsx to use dayjs
  • Refactor app/common/academic-calendar.tsx to use dayjs
  • Refactor app/devtools/learning-center-api.tsx to use dayjs
  • Refactor app/toolbox/learning-center/seat-time-status.tsx to use format constants
  • Address code review feedback
  • Use DATETIME_SECOND_FORMAT constant instead of hardcoded strings
  • Add DATE_FORMAT_DASH constant for 'YYYY-MM-DD' format
  • Replace all hardcoded format strings with constants from lib/constants.ts
  • Lint and verify all changes

All datetime handling code has been successfully refactored to use dayjs library instead of native JavaScript Date methods. All datetime format strings are now centralized in lib/constants.ts for consistency and maintainability.

Code Review Feedback Addressed:

  • Fixed remaining new Date() call in utils/learning-center/date.ts
  • Simplified QR scanner time validation using isSameOrAfter and isSameOrBefore plugins
  • Replaced hardcoded format strings with DATETIME_SECOND_FORMAT constant from lib/constants
  • Added new DATE_FORMAT_DASH constant for 'YYYY-MM-DD' format
  • Replaced all hardcoded 'YYYY-MM-DD' with DATE_FORMAT_DASH
  • Replaced all hardcoded 'HH:mm' with TIME_FORMAT

Impact:

  • All datetime formats are now centralized in lib/constants.ts
  • Improved code maintainability by eliminating hardcoded format strings
  • Consistent datetime handling across the entire codebase
  • All changes pass linting with no new warnings introduced
Original prompt

Refactor existing codes about datetime display which is not handled by dayjs. For usage of dayjs, please reference current codebase with dayjs.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 30, 2025 14:33
Co-authored-by: renbaoshuo <47095648+renbaoshuo@users.noreply.github.com>
Co-authored-by: renbaoshuo <47095648+renbaoshuo@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor datetime display to use dayjs Refactor datetime handling to use dayjs consistently Oct 30, 2025
Copilot AI requested a review from renbaoshuo October 30, 2025 14:39
Copilot finished work on behalf of renbaoshuo October 30, 2025 14:39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Seeridia @weijianxian (original author) to review learning-center-related code

Co-authored-by: renbaoshuo <47095648+renbaoshuo@users.noreply.github.com>
Copilot AI requested a review from renbaoshuo November 5, 2025 07:24
Copilot finished work on behalf of renbaoshuo November 5, 2025 07:24
@klxiaoniu
Copy link
Contributor

@copilot 涉及到日期时间格式的,使用我们先前在constants.ts中的定义,如果没有定义的话就添加对应定义并在代码中引用

…s with constants

Co-authored-by: klxiaoniu <48382562+klxiaoniu@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 5, 2025

@copilot 涉及到日期时间格式的,使用我们先前在constants.ts中的定义,如果没有定义的话就添加对应定义并在代码中引用

Fixed in 2cedc25. Added DATE_FORMAT_DASH constant to lib/constants.ts and replaced all hardcoded format strings:

  • 'YYYY-MM-DD' → DATE_FORMAT_DASH
  • 'HH:mm' → TIME_FORMAT

All datetime format strings now use constants from lib/constants.ts.

Copilot AI changed the title Refactor datetime handling to use dayjs consistently Refactor datetime handling to use dayjs consistently and centralize format constants Nov 5, 2025
Copilot AI requested a review from klxiaoniu November 5, 2025 08:51
Copilot finished work on behalf of klxiaoniu November 5, 2025 08:51
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 this pull request may close these issues.

3 participants