Skip to content

Conversation

@t-regbs
Copy link
Owner

@t-regbs t-regbs commented Sep 7, 2025

Fixes bug with alarm scheduling and migrates usage of java.util.Calendar to kotlinx LocalDateTime

This commit replaces all usages of `java.util.Calendar` with the modern `kotlinx-datetime` library for improved date and time handling.

Key changes include:
- Replaced `Calendar` with `LocalDateTime`, `Instant`, and `LocalTime` where appropriate.
- Updated `CalendarProvider` to `DateTimeProvider` and its implementation.
- Refactored alarm scheduling and cancellation logic in `AlarmNotificationScheduler` to use `kotlinx-datetime`.
- Updated utility functions in `AlarmUtil.kt` to work with `kotlinx-datetime` types, including `getFormatTime`, `initLocalDateTimeInSystemZone`, and `getTimeLeft`.
- Modified `SnoozeAlarm` use case to use `DateTimeProvider` and `LocalDateTime`.
- Adjusted UI components to use `kotlinx-datetime`.
- Introduced `OnClearEmptyAlarmsClick` event in `AlarmListEvent` and corresponding handling in `AlarmListViewModel` and `AlarmListScreen`.
- Ensured `setExactAlarm` in `ContextExtensions.kt` correctly handles past alarm times by scheduling for the next week.
@t-regbs t-regbs merged commit a7b8852 into main Sep 7, 2025
2 checks passed
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.

2 participants