Skip to content

Commit

Permalink
[~] fix recurrence until
Browse files Browse the repository at this point in the history
  • Loading branch information
zavyalov-daniil committed Feb 5, 2024
1 parent e0446bf commit be60bf8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.api.services.calendar.model.Event
import com.google.api.services.calendar.model.Event.Organizer
import com.google.api.services.calendar.model.EventAttendee
import com.google.api.services.calendar.model.EventDateTime
import model.Recurrence.Companion.toRecurrence
import office.effective.model.Recurrence.Companion.toRecurrence
import office.effective.common.constants.BookingConstants
import office.effective.common.utils.UuidValidator
import office.effective.dto.BookingDTO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package office.effective.features.booking.converters

import model.Ending
import model.Freq
import model.Recurrence
import java.text.SimpleDateFormat
import java.util.Formatter
import java.util.GregorianCalendar
import office.effective.model.Ending
import office.effective.model.Freq
import office.effective.model.Recurrence

/**
* Object for creating Google calendar recurrence rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package model
package office.effective.model

import model.RecurrenceDTO
import office.effective.common.constants.BookingConstants
import java.lang.IllegalArgumentException
import java.text.SimpleDateFormat
Expand Down Expand Up @@ -48,14 +49,12 @@ data class Recurrence(
* @author Kiselev Danil
* */
private fun toDateRfc5545(millisDate: Long): String {
val time = GregorianCalendar().apply { timeInMillis = millisDate }//+ 86400000 }
val a = SimpleDateFormat(BookingConstants.UNTIL_FORMAT).format(time.time) + "T235959;TZID=" + TimeZone.getDefault().id//a = "TZID=" + TimeZone.getDefault().id + ":" + SimpleDateFormat(BookingConstants.UNTIL_FORMAT).format(time.time);
return SimpleDateFormat(BookingConstants.UNTIL_FORMAT).format(time.time) //+ "T060000Z"
//+ "T235959;TZID=" + TimeZone.getDefault().id
val time = GregorianCalendar().apply { timeInMillis = millisDate + 86400000 }
return SimpleDateFormat(BookingConstants.UNTIL_FORMAT).format(time.time)
}
}

fun toDto(): RecurrenceDTO = RecurrenceDTO(
public fun toDto(): RecurrenceDTO = RecurrenceDTO(
interval = if (interval != 0) interval else null,
freq = freq.name,
count = if (ending is Ending.Count) ending.value else null,
Expand Down

0 comments on commit be60bf8

Please sign in to comment.