mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-27 22:34:42 +02:00
Fix:Local sessions set date and dayOfWeek using the updatedAt timestamp passed in from the client #2795
This commit is contained in:
parent
1396a432a4
commit
aefda8bd51
1 changed files with 7 additions and 2 deletions
|
@ -144,8 +144,13 @@ class PlaybackSessionManager {
|
||||||
session.currentTime = sessionJson.currentTime
|
session.currentTime = sessionJson.currentTime
|
||||||
session.timeListening = sessionJson.timeListening
|
session.timeListening = sessionJson.timeListening
|
||||||
session.updatedAt = sessionJson.updatedAt
|
session.updatedAt = sessionJson.updatedAt
|
||||||
session.date = date.format(new Date(), 'YYYY-MM-DD')
|
|
||||||
session.dayOfWeek = date.format(new Date(), 'dddd')
|
let jsDate = new Date(sessionJson.updatedAt)
|
||||||
|
if (isNaN(jsDate)) {
|
||||||
|
jsDate = new Date()
|
||||||
|
}
|
||||||
|
session.date = date.format(jsDate, 'YYYY-MM-DD')
|
||||||
|
session.dayOfWeek = date.format(jsDate, 'dddd')
|
||||||
|
|
||||||
Logger.debug(`[PlaybackSessionManager] Updated session for "${session.displayTitle}" (${session.id})`)
|
Logger.debug(`[PlaybackSessionManager] Updated session for "${session.displayTitle}" (${session.id})`)
|
||||||
await Database.updatePlaybackSession(session)
|
await Database.updatePlaybackSession(session)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue