From 79d8704220f2610dc6ed19e6bca44257b4c0ecc6 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Thu, 2 Jan 2025 15:54:45 +0100 Subject: [PATCH 1/2] feat(match2): don't show countdowns for empty dates on FFA/BR --- components/match2/commons/match_group_util.lua | 1 + .../ffa/widget_match_summary_ffa_game_countdown.lua | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/components/match2/commons/match_group_util.lua b/components/match2/commons/match_group_util.lua index 0d61e2ac47..839462fb34 100644 --- a/components/match2/commons/match_group_util.lua +++ b/components/match2/commons/match_group_util.lua @@ -690,6 +690,7 @@ function MatchGroupUtil.gameFromRecord(record, opponentCount) return { comment = nilIfEmpty(Table.extract(extradata, 'comment')), date = record.date, + dateIsExact = nilIfEmpty(Table.extract(extradata, 'dateexact')), extradata = extradata, game = record.game, header = nilIfEmpty(Table.extract(extradata, 'header')), diff --git a/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua b/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua index d1f0ac3605..518c35d755 100644 --- a/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua +++ b/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua @@ -28,11 +28,18 @@ function MatchSummaryFfaGameCountdown:render() end local timestamp = Date.readTimestamp(game.date) - if not timestamp then + if not timestamp or timestamp == Date.defaultTimestamp then return end - -- TODO Use local TZ - local dateString = Date.formatTimestamp('F j, Y - H:i', timestamp) .. ' ' .. Timezone.getTimezoneString('UTC') + + local dateString + if game.dateIsExact == true then + -- TODO: Use game-TZ + dateString = Date.formatTimestamp('F j, Y - H:i', timestamp) .. ' ' + .. Timezone.getTimezoneString('UTC') + else + dateString = mw.getContentLanguage():formatDate('F j, Y', game.date) + end local streamParameters = Table.merge(game.stream, { date = dateString, From f0966e96ec517e0a6c4c0c8a4abf0b95edf3b8da Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Thu, 2 Jan 2025 20:18:26 +0100 Subject: [PATCH 2/2] Update components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- .../summary/ffa/widget_match_summary_ffa_game_countdown.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua b/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua index 518c35d755..46ef85a0d0 100644 --- a/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua +++ b/components/widget/match/summary/ffa/widget_match_summary_ffa_game_countdown.lua @@ -33,7 +33,7 @@ function MatchSummaryFfaGameCountdown:render() end local dateString - if game.dateIsExact == true then + if game.dateIsExact then -- TODO: Use game-TZ dateString = Date.formatTimestamp('F j, Y - H:i', timestamp) .. ' ' .. Timezone.getTimezoneString('UTC')