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

feat(meetings): Show upcoming events 📆 #1968

Merged
merged 5 commits into from
Feb 6, 2025

Conversation

Ivansss
Copy link
Member

@Ivansss Ivansss commented Feb 4, 2025

IMG_E0131

@Ivansss Ivansss requested a review from SystemKeeper February 4, 2025 16:34
Copy link
Collaborator

@SystemKeeper SystemKeeper left a comment

Choose a reason for hiding this comment

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

I am not sure about the eventTime method. This seems problematic, translation-wise. shouldn't we better use DateFormatter with the desired format and enable relative formatting and not handle that ourselves?

NextcloudTalk/CalendarEvent.swift Outdated Show resolved Hide resolved
NextcloudTalk/CalendarEvent.swift Outdated Show resolved Hide resolved
NextcloudTalk/NCAPIControllerExtensions.swift Outdated Show resolved Hide resolved
NextcloudTalk/NCUtils.swift Outdated Show resolved Hide resolved
@Ivansss
Copy link
Member Author

Ivansss commented Feb 5, 2025

Couldn't find a way to display event start time the same way as in the web using RelativeDateTimeFormatter()

@SystemKeeper
Copy link
Collaborator

For today and tomorrow I would go with

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .short
dateFormatter.doesRelativeDateFormatting = true

let now = Date()
let tomorrow = Calendar.current.date(byAdding: .day, value: 1, to: now)!

print(dateFormatter.string(from: now))
print(dateFormatter.string(from: tomorrow))

which prints for my locale:

Heute um 20:49
Morgen um 20:49

Personally I would also be fine to just use it for all other cases as well, it would show:

12. Februar 2025 um 20:49

for next week.

.full would also work for dateStyle showing:

Mittwoch, 12. Februar 2025 um 20:51

Alternatively (if we can live without the "at"):

let localeArray = ["en_US", "de_DE"]
for localeID in localeArray {
    print(now.formatted(.dateTime
             .weekday(.wide)
             .hour(.conversationalTwoDigits(amPM: .wide))
             .minute(.defaultDigits)
             .locale(Locale(identifier: localeID))
    ))
}

could be used for the < 1 week and displays:

Wednesday 08:55 PM
Mittwoch, 20:55

Copy link
Collaborator

@SystemKeeper SystemKeeper left a comment

Choose a reason for hiding this comment

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

👌

@SystemKeeper SystemKeeper merged commit 0f680b6 into master Feb 6, 2025
11 checks passed
@SystemKeeper SystemKeeper deleted the feat/noid/show-upcoming-events branch February 6, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants