Shouldn't zmanim related to chametz return null when it isn't erev pesach?
Here's how I would do this if you where rebuilding in Kotlin
Have a sealed class of Special Zmanim (or another name) that is returned in a list
so each day has
ZmanimForToday {
all the regular fields, date, sunrise, sunset...
List {
CandleLighting, Chametz, Fasting....
}
}
that way the api can just add or omit items to the list for the given day (fast days, chametz, etc..) and the UI side of things can just render the data directly from the api
in a nutshell, the UI should not have to know or care about the specifics for the given day, it should just render whatever is returned from the api for that day
taking this further, there can be a Configuration class (for things like InIsrael) which is used to initialize the zmanim "engine"
This way you pass the settings in once and create your engine which drives the UI
Shouldn't zmanim related to chametz return null when it isn't erev pesach?
Here's how I would do this if you where rebuilding in Kotlin
Have a sealed class of Special Zmanim (or another name) that is returned in a list
so each day has
ZmanimForToday {
all the regular fields, date, sunrise, sunset...
List {
CandleLighting, Chametz, Fasting....
}
}
that way the api can just add or omit items to the list for the given day (fast days, chametz, etc..) and the UI side of things can just render the data directly from the api
in a nutshell, the UI should not have to know or care about the specifics for the given day, it should just render whatever is returned from the api for that day
taking this further, there can be a Configuration class (for things like InIsrael) which is used to initialize the zmanim "engine"
This way you pass the settings in once and create your engine which drives the UI