Title: Recommended way to model attendance records...
# android
m
Title: Recommended way to model attendance records in Room? I'm designing a school/maktab management app using Room and I'm unsure about the best way to store attendance dates. Should I store the attendance date as: •
Long
(epoch milliseconds or epoch days) •
Date
•
LocalDate
(with a
TypeConverter
) • Something else? My current attendance model is roughly:
Copy code
@Entity
data class AttendanceEntity(
    @PrimaryKey(autoGenerate = true)
    val id: Long = 0,
    val studentId: Long,
    val attendanceDate: ???,
    val isPresent: Boolean
)
My goals are: • Record one attendance entry per student per day. • Generate monthly attendance reports. • Display attendance trends using bar/line charts. • Query attendance efficiently by day, week, month, and custom date ranges. • Sync the same data with a backend database in the future. I'm mainly confused about the date field. I don't need to store the exact time—only the calendar day. What data type would you recommend for
attendanceDate
, and why? Are there any trade-offs between storing a
Long
,
Date
, or
LocalDate
in Room for this use case?
not kotlin but kotlin colored 4