package com.pixelized.headache.utils.extention

import android.icu.util.Calendar
import com.pixelized.headache.repository.event.Event

var Calendar.event: Event.Date
    get() = Event.Date(
        day = get(Calendar.DAY_OF_MONTH),
        month = get(Calendar.MONTH),
        year = get(Calendar.YEAR),
    )
    set(value) {
        set(java.util.Calendar.YEAR, value.year)
        set(java.util.Calendar.MONTH, value.month)
        set(java.util.Calendar.DAY_OF_MONTH, value.day)
        set(java.util.Calendar.HOUR_OF_DAY, 0)
        set(java.util.Calendar.MINUTE, 0)
        set(java.util.Calendar.SECOND, 0)
        set(java.util.Calendar.MILLISECOND, 0)
    }