Skip to content

Commit

Permalink
fixed weekendTimeStamp, added a comment for clarity
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
  • Loading branch information
rapterjet2004 authored and backportbot[bot] committed Sep 4, 2024
1 parent 739aef3 commit 6cc1599
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ class DateTimePickerFragment : DialogFragment() {
tomorrowTimeStamp = getTimeFromCalendar(
hour = HOUR_EIGHT_AM,
minute = 0,
daysToAdd = 1,
daysToAdd = 1
)

binding.dateTimePickerWeekend.visibility = View.GONE // because today is the weekend
} else {
tomorrowTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, minute = 0, daysToAdd = 1)
weekendTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, day = Calendar.SATURDAY, minute = 0)
weekendTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, weekDay = Calendar.SATURDAY, minute = 0)
}
binding.dateTimePickerTomorrowTextview.text = getTimeFromTimeStamp(tomorrowTimeStamp)
binding.dateTimePickerWeekendTextview.text = getTimeFromTimeStamp(weekendTimeStamp)
Expand Down Expand Up @@ -249,6 +249,9 @@ class DateTimePickerFragment : DialogFragment() {
timePicker.show(this.parentFragmentManager, TAG)
}

/**
* You can use `weekDay` or `daysToAdd` or neither but don't use both b/c it messes up the calendar
*/
@Suppress("LongParameterList")
private fun getTimeFromCalendar(
year: Int = Calendar.getInstance().get(Calendar.YEAR),
Expand Down

0 comments on commit 6cc1599

Please sign in to comment.