Android icon indicating copy to clipboard operation
Android copied to clipboard

feat: Add time selection to date picker with ISO datetime storage

Open vijay2909 opened this issue 3 months ago • 1 comments

Requirement The issue required adding time selection capability to the existing date picker functionality. Previously, users could only select dates without specific times, which limited precision for time-sensitive features.

Changes Made

  1. Enhanced Picker Flow:
  • Modified date selection to trigger time picker automatically after date is chosen
  • Combined date and time into a single ZonedDateTime object
  • Updated UI to display both date and time in the input field
  1. Data Storage Migration:
  • Changed database storage format from milliseconds (long) to ISO 8601 strings
  • ISO format provides timezone awareness and better interoperability
  • Maintained backward compatibility through migration handling
  1. DateTimeUtils Class:
  • Created utility class with helper methods for datetime conversions
  • Added methods for formatting, parsing, and validation
  • Implemented comprehensive test coverage with 100% pass rate
  1. Testing:
  • Added complete test suite for DateTimeUtils using Espresso and Robolectric
  • Verified date-time combination logic and formatting
  • Ensured edge cases and timezone handling work correctly

Technical Details

  • Uses MaterialDatePicker and MaterialTimePicker for consistent UI
  • ZonedDateTime for proper timezone handling throughout the application
  • ISO 8601 format for future-proof data storage and exchange

Maintains existing API contracts while extending functionality

The implementation provides users with precise datetime selection while maintaining data integrity and test reliability.

Fixes: #2284

vijay2909 avatar Sep 30 '25 17:09 vijay2909

Wow, that was fast :)

The description sounds like this is going in the right direction. Thank you for this.

I might take a while until I can review this, I want to try to finish up #2716 somewhat soon to fix issues with barcodes with Cyrillic and similar issues, and I have a busy week coming up, but after that I'll definitely take a look at this :)

TheLastProject avatar Sep 30 '25 20:09 TheLastProject