Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions web/src/views/Standups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -336,21 +336,49 @@ export default {
// Treat as date-only value to avoid timezone shifts
if (!dateString) return ''

// Helper function for fallback parsing
const fallbackParse = () => {
try {
const date = new Date(dateString)
if (isNaN(date.getTime())) return 'Invalid date'
return date.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})
Comment on lines +344 to +349

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

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

The date formatting options object is duplicated in both fallbackParse() and the main return path. This increases the chance of the two outputs diverging over time. Consider extracting the toLocaleDateString options into a single constant (e.g., const dateFormatOptions = { ... }) and reusing it in both places.

Copilot uses AI. Check for mistakes.
} catch (e) {
return 'Invalid date'
}
}

const dateOnly = dateString.includes('T') ? dateString.split('T')[0] : dateString
const parts = dateOnly.split('-')

if (parts.length !== 3) {
// Fallback to standard parsing if format is unexpected
return new Date(dateString).toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})
return fallbackParse()
}

const [year, month, day] = parts.map(Number)
const date = new Date(year, month - 1, day) // Use local timezone with specific date parts

// Validate that year, month, and day are finite numbers within expected ranges
if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day) ||
year < 1000 || year > 9999 || month < 1 || month > 12 || day < 1 || day > 31) {
// Values are invalid, return error message
return 'Invalid date'
}

// Construct date and validate it matches the input values
const date = new Date(year, month - 1, day)
if (isNaN(date.getTime()) ||
date.getFullYear() !== year ||
date.getMonth() !== month - 1 ||
date.getDate() !== day) {
// Date rolled over (e.g., Feb 31 -> Mar 3), so it's invalid
return 'Invalid date'
}

return date.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
Expand Down