Fix:Local sessions set date and dayOfWeek using the updatedAt timestamp passed in from the client #2795

This commit is contained in:
advplyr 2024-03-30 11:40:35 -05:00
parent 1396a432a4
commit aefda8bd51

View File

@ -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)