Skip to content

Commit 7507027

Browse files
committed
fix: check locale is valid
1 parent 9632adb commit 7507027

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lua/calendar/view.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ local function render_lines(year, month, grid)
6060
local lines = {}
6161
local CALENDAR_WIDTH, WEEKDAY_WIDTH = 33, 3
6262

63+
-- check if locale exists
64+
if not locales[locale] then
65+
locales = require('calendar.locales')
66+
locale = 'en-US'
67+
end
68+
6369
local months = locales[locale].months
6470
local year_month = locales[locale].year_month(year, month, months)
6571
table.insert(lines, center(year_month, CALENDAR_WIDTH))

0 commit comments

Comments
 (0)