Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add month and date at sharing text. #904

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Comment on lines +97 to +98
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Would it be better to use val day: DroidKaigi2024Day? ? 🤔
I avoided it because it was Nullable, but I feel like it would be okay to just leave it empty when it's null.

}

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