date logic changed#358
Open
chanabyte wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates week/date handling across the API and admin UI by replacing custom UTC/week-boundary logic with dayjs (UTC + ISO week), while also expanding the admin form builder experience (history filtering UI, publish success + empty-form draft flows, and form deletion).
Changes:
- Standardize week-bound computations (Mon–Sun, UTC) and date formatting using
dayjs+isoWeek+utcin server endpoints and admin pages. - Improve admin builder UX: history toolbar + advanced filter drawer, keyword search, empty-form draft prompt, publish success modal, and delete action.
- Regenerate/update
package-lock.jsonmetadata.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| server/api/form/index.ts | Switch weekday formatting + weekly bounds to dayjs.utc().startOf/endOf('isoWeek'). |
| server/api/admin/class-progress.get.ts | Replace custom date/week parsing + YMD formatting with dayjs ISO-week logic for filtering and output. |
| app/composables/useAdmin.ts | Update date formatting, add builder state for new filters/modals, and refactor publish flow + deletion support. |
| app/pages/admin/builder.vue | Update builder UI to use new composable state, add modals and advanced filters drawer, and adjust week label logic. |
| app/pages/admin/raffle.vue | Replace getLastMonday usage with dayjs ISO-week week-start display. |
| app/pages/admin/styles/builder.css | Add styles for new modals, toolbar/drawer UI, and empty-form/publish-success presentation. |
| package-lock.json | Lockfile metadata churn (peer flags and related fields). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+391
to
+396
| const createdFormResponse = await callFormApi<any>('POST', {}, { | ||
| action: 'createForm', | ||
| startDate: weekStart || dayjs.utc().startOf('isoWeek').format('YYYY-MM-DD'), | ||
| published, | ||
| title: formTitle.value, | ||
| }) |
Comment on lines
39
to
+41
| if (selectedDate) { | ||
| const { mondayDate, sundayDate } = getWeekBoundsDates(selectedDate) | ||
| const mondayDate = dayjs.utc(selectedDate).startOf('isoWeek').toDate() | ||
| const sundayDate = dayjs.utc(selectedDate).endOf('isoWeek').toDate() |
Comment on lines
+106
to
+107
| const mondayDate = dayjs.utc(selectedDate).startOf('isoWeek').toDate() | ||
| const sundayDate = dayjs.utc(selectedDate).endOf('isoWeek').toDate() |
Comment on lines
+172
to
+173
| const mondayDate = dayjs.utc(selectedDate).startOf('isoWeek').toDate() | ||
| const sundayDate = dayjs.utc(selectedDate).endOf('isoWeek').toDate() |
Comment on lines
+179
to
+182
| .empty-form-copy { margin: 0; color: #374151; font-weight: 500; line-height: 1.5; } | ||
|
|
||
| .empty-form-copy { margin: 0; color: #374151; font-weight: 500; line-height: 1.5; } | ||
|
|
| <div class="modal-box"> | ||
| <div class="modal-header"> | ||
| <div> | ||
| <h3 class="modal-title">You cannot publish because its empty.</h3> |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.