Skip to content

Commit

Permalink
Merge pull request #904 from sadashi-ota/feature/sharing_date
Browse files Browse the repository at this point in the history
Add month and date at sharing text.
  • Loading branch information
takahirom authored Sep 1, 2024
2 parents b59871a + 65919fc commit ac68d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ private class ExternalNavController(

fun onShareClick(timetableItem: TimetableItem) {
shareNavigator.share(
"[${timetableItem.room.name.currentLangTitle}] ${timetableItem.startsTimeString} - ${timetableItem.endsTimeString}\n" +
"[${timetableItem.room.name.currentLangTitle}] ${timetableItem.formattedMonthAndDayString} " +
"${timetableItem.startsTimeString} - ${timetableItem.endsTimeString}\n" +
"${timetableItem.title.currentLangTitle}\n" +
timetableItem.url,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public sealed class TimetableItem {
"$startsDateString / $formattedTimeString ($minutesString)"
}

public val formattedMonthAndDayString: String by lazy {
val localDate = startsAt.toLocalDateTime(TimeZone.currentSystemDefault())
"${localDate.monthNumber}".padStart(2, '0') + "/" + "${localDate.dayOfMonth}".padStart(2, '0')
}

public val url: String get() = if (defaultLang() == Lang.JAPANESE) {
"https://2024.droidkaigi.jp/timetable/${id.value}"
} else {
Expand Down

0 comments on commit ac68d35

Please sign in to comment.