feat(test-app): default notification time to current + 3 minutes

Replace hardcoded '09:00' default with dynamic calculation that sets
the notification time to 3 minutes from now (rounded up to next minute).
This makes it more convenient for users to quickly test notifications
without manually adjusting the time field.
This commit is contained in:
Jose Olarte III
2026-01-06 19:27:05 +08:00
parent f446362984
commit 766d56c661

View File

@@ -57,13 +57,33 @@ import router from '../router'
@Component
class ScheduleView extends Vue {
scheduleTime = '09:00'
scheduleTime = this.getDefaultScheduleTime()
notificationTitle = 'Daily Update'
notificationMessage = 'Your daily notification is ready!'
isScheduling = false
isTesting = false
scheduleFeedback: { type: 'success' | 'error' | 'info', message: string } | null = null
/**
* Calculate default schedule time as current time + 3 minutes (rounded up)
* @returns Time string in HH:MM format
*/
getDefaultScheduleTime(): string {
const now = new Date()
// Round up to next minute if there are any seconds
if (now.getSeconds() > 0 || now.getMilliseconds() > 0) {
now.setMinutes(now.getMinutes() + 1)
now.setSeconds(0)
now.setMilliseconds(0)
}
// Add 3 minutes
now.setMinutes(now.getMinutes() + 3)
// Format as HH:MM
const hours = now.getHours().toString().padStart(2, '0')
const minutes = now.getMinutes().toString().padStart(2, '0')
return `${hours}:${minutes}`
}
goBack() {
router.push('/')
}