Closed jokabrink closed 7 months ago
I had a bit more time to dig into this. The possible above fixes are garbage, I didn't quite know the API and JS.
But now I think I got a fix. The problem and solution is described in this SO post. Cut short, the time part needs to be set to 00:00 for proper day differences. This could be done via .from(moment().startOf('day'))
instead of .fromNow()
. The fix is a one liner at https://github.com/nextcloud/calendar/blob/main/src/views/Dashboard.vue#L256.
I had a bit more time to dig into this. The possible above fixes are garbage, I didn't quite know the API and JS.
But now I think I got a fix. The problem and solution is described in this SO post. Cut short, the time part needs to be set to 00:00 for proper day differences. This could be done via
.from(moment().startOf('day'))
instead of.fromNow()
. The fix is a one liner at https://github.com/nextcloud/calendar/blob/main/src/views/Dashboard.vue#L256.
wanna open a PR with your oneliner? Happy to approve!
The issue appears to be fixed.
Steps to reproduce
Expected behavior
The difference of calendar days. So when the current date shows 12.01.2023 21:42, the appointment should show
in 8 days
.Actual behaviour
An approximate rounding of days depending on the current time. So a date on 20.01.2023 is sometimes in 8 days, sometimes in 7.
The reason appears to be the following. Execute this via node with
@nextcloud/moment
installed:Output:
The
moment
package introduces an approximate rounding. Possible solution is to change https://github.com/nextcloud/calendar/blob/main/src/views/Dashboard.vue#L241 accordingly. An idea would be to add another case likenextMonth
with usingt('calendar', '[in %n days]')
instead of relying onmoment
.Also, I believe this
.replace('replace-from-now', moment(event.start).locale(locale)
in https://github.com/nextcloud/calendar/blob/main/src/views/Dashboard.vue#L256 could be moved to https://github.com/nextcloud/calendar/blob/main/src/views/Dashboard.vue#L255.Calendar app version
4.1.1
CalDAV-clients used
Web App
Browser
No response
Client operating system
No response
Server operating system
No response
Web server
None
Database engine version
None
PHP engine version
None
Nextcloud version
No response
Updated from an older installed version or fresh install
Updated from an older version
List of activated apps
No response
Nextcloud configuration
No response
Web server error log
No response
Log file
No response
Browser log
No response
Additional info
No response