Skip to content

Using DateRange widget in TournamentsList #6476

@ElectricalBoy

Description

@ElectricalBoy

Maybe we can replace the start date/end date in the infobox with this too?

imo it is better to show the full ISO 8601 date in infobox
I think we could convert TournamentsList to use DateRange though

Originally posted by @ElectricalBoy in #6461 (comment)

---@param startDate string
---@param endDate string
---@param status string?
---@return string
function BaseTournamentsListing._dateDisplay(startDate, endDate, status)
if status == POSTPONED or status == DELAYED then
return 'Postponed'
end
if startDate == endDate then
return LANG:formatDate('M j, Y', startDate) --[[@as string]]
end
local startYear, startMonth = startDate:match('(%d+)-(%d+)-%d+')
local endYear, endMonth = endDate:match('(%d+)-(%d+)-%d+')
if startYear ~= endYear then
return LANG:formatDate('M j, Y', startDate) .. ' - ' .. LANG:formatDate('M j, Y', endDate)
end
if startMonth == endMonth then
return LANG:formatDate('M j', startDate) .. ' - ' .. LANG:formatDate('j, Y', endDate)
end
return LANG:formatDate('M j', startDate) .. ' - ' .. LANG:formatDate('M j, Y', endDate)
end

TournamentsList template (or more precisely, Module:TournamentsListing/CardList) displays month, day, and year for range, while the DateRange widget currently displays only month and day.

To be able to use the DateRange widget in the TournamentsList template, we need to add year support to it. (#6824 )

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions