Skip to content

Commit

Permalink
Fix:Local sessions set date and dayOfWeek using the updatedAt timesta…
Browse files Browse the repository at this point in the history
…mp passed in from the client #2795
  • Loading branch information
advplyr committed Mar 30, 2024
1 parent 1396a43 commit aefda8b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/managers/PlaybackSessionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,13 @@ class PlaybackSessionManager {
session.currentTime = sessionJson.currentTime
session.timeListening = sessionJson.timeListening
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})`)
await Database.updatePlaybackSession(session)
Expand Down

0 comments on commit aefda8b

Please sign in to comment.