fix: display default reset date when limitResetDate is null
Fixed empty "Resets on" date display for new users: Issue: - Users who haven't created any conversations yet have limitResetDate = NULL - The "Resets on" field was showing empty/blank - This confused users about when their limit would reset Solution: - Updated formatResetDate() in 3 components to calculate default date - If limitResetDate is NULL, display "1 month from now" - This gives users a clear expectation of when limits reset Files Updated: - app/[locale]/subscription/page.tsx * formatResetDate() now returns calculated date if null - components/subscription/usage-display.tsx * formatResetDate() now returns calculated date if null - components/subscription/upgrade-modal.tsx * formatResetDate() now returns calculated date if null * Removed conditional check - always show reset date User Experience: - New users see "Resets on: [date one month from now]" - Once they create their first conversation, actual reset date is set - Consistent messaging across all subscription UI components Note: The actual limitResetDate is set when the user creates their first conversation (in incrementConversationCount function). This fix only affects the UI display for users who haven't chatted yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -164,7 +164,12 @@ export default function SubscriptionPage() {
|
||||
}
|
||||
|
||||
const formatResetDate = (dateString: string | null) => {
|
||||
if (!dateString) return ''
|
||||
if (!dateString) {
|
||||
// If no reset date set, calculate 1 month from now
|
||||
const nextMonth = new Date()
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1)
|
||||
return nextMonth.toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' })
|
||||
}
|
||||
const date = new Date(dateString)
|
||||
return date.toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user