Skip to content

Commit

Permalink
Should be fixed for good , need to test though
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 57e152b commit 739aef3
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class DateTimePickerFragment : DialogFragment() {
hour = HOUR_EIGHT_AM,
minute = 0,
daysToAdd = 1,
weekInYear =
currentWeekInYear + 1
)

binding.dateTimePickerWeekend.visibility = View.GONE // because today is the weekend
Expand All @@ -117,7 +115,7 @@ class DateTimePickerFragment : DialogFragment() {

nextWeekTimeStamp = getTimeFromCalendar(
hour = HOUR_EIGHT_AM,
day = Calendar.MONDAY,
weekDay = Calendar.MONDAY,
minute = 0,
weekInYear =
currentWeekInYear + 1
Expand Down Expand Up @@ -255,18 +253,18 @@ class DateTimePickerFragment : DialogFragment() {
private fun getTimeFromCalendar(
year: Int = Calendar.getInstance().get(Calendar.YEAR),
month: Int = Calendar.getInstance().get(Calendar.MONTH),
day: Int = Calendar.getInstance().get(Calendar.DAY_OF_WEEK),
day: Int = Calendar.getInstance().get(Calendar.DAY_OF_YEAR),
hour: Int = Calendar.getInstance().get(Calendar.HOUR_OF_DAY),
minute: Int = Calendar.getInstance().get(Calendar.MINUTE),
daysToAdd: Int = 0,
weekInYear: Int = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR)
weekInYear: Int = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR),
weekDay: Int = -1
): Long {
val calendar: Calendar = Calendar.getInstance().apply {
set(Calendar.YEAR, year)
set(Calendar.MONTH, month)
set(Calendar.DAY_OF_WEEK, day)
add(Calendar.DAY_OF_WEEK, daysToAdd)
set(Calendar.WEEK_OF_YEAR, weekInYear)
if (weekDay > -1) set(Calendar.DAY_OF_WEEK, weekDay) else set(Calendar.DAY_OF_YEAR, day)
if (daysToAdd > 0) add(Calendar.DAY_OF_YEAR, daysToAdd) else set(Calendar.WEEK_OF_YEAR, weekInYear)
set(Calendar.HOUR_OF_DAY, hour)
set(Calendar.MINUTE, minute)
set(Calendar.SECOND, 0)
Expand Down

0 comments on commit 739aef3

Please sign in to comment.