Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes improper time formatter causing crashes #6396

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

walmat
Copy link
Contributor

@walmat walmat commented Jan 11, 2025

What changed (plus any additional context for devs)

1. Date Formatting Refactor

New Utility Function

  • Added dateFormatter utility function in SettingsSheet/utils.ts
  • Provides centralized date formatting with error handling
  • Uses date-fns format function with fallback to 'Unknown Date'

Implementation Changes

  • Removed direct date-fns imports from component files
  • Consolidated date formatting logic into a single utility function
  • Default format string set to "M/d/yy 'at' h:mm a"

2. Backup File Sorting Enhancement

Error Handling

  • Added try-catch blocks around timestamp parsing logic
  • Returns 0 as fallback when timestamp parsing fails
  • Implemented in both ChooseBackupStep and ViewCloudBackups components

Code Organization

  • Improved type safety with explicit LoadingTextProps interface
  • Better error handling for backup file timestamp parsing
  • Consistent sorting behavior across backup-related components

3. Component Improvements

Type Safety Enhancements

  • Added proper typing for theme props
  • Introduced LoadingTextProps interface for better type checking
  • Improved component prop definitions

This PR focuses on improving the robustness of the cloud backup system by adding proper error handling and centralizing date formatting logic. The changes make the backup system more resilient to invalid dates while maintaining consistent date formatting across the application.

more details here

Screen recordings / screenshots

What to test

@brunobar79
Copy link
Member

Launch in simulator or device for 9ba8591

@walmat walmat merged commit 28ffd48 into develop Jan 14, 2025
8 checks passed
@walmat walmat deleted the @matthew/fix-invalid-time branch January 14, 2025 15:48
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.

4 participants