@@ -29,13 +29,17 @@ local upgradeWindow = if nextChannelOverlay != null then
2929local formatDate(date) =
3030 local lastChange = std.reverse([t for t in std.objectFields (dst) if t < date])[0 ];
3131 local UTCOffset = dst[lastChange];
32- local YMD = std.split (date, 'T' )[0 ];
33- local Y = std.split (YMD, '-' )[0 ];
34- local M = std.split (YMD, '-' )[1 ];
35- local D = std.split (YMD, '-' )[2 ];
36- local hms = std.split (date, 'T' )[1 ];
37- local h = std.toString (std.parseInt (std.split (hms, ':' )[0 ]) + UTCOffset);
38- local m = std.split (hms, ':' )[1 ];
32+ local parts = std.split (date, 'T' );
33+ assert std.length (parts) == 2 : 'Expected RFC-3339 datetime to have exactly one "T"' ;
34+ local YMD = std.split (parts[0 ], '-' );
35+ assert std.length (YMD) == 3 : 'Expected RFC-3339 date to have exactly two "-"' ;
36+ local Y = YMD[0 ];
37+ local M = YMD[1 ];
38+ local D = YMD[2 ];
39+ local hms = std.split (parts[1 ], ':' );
40+ assert std.length (hms) == 3 : 'Expected RFC-3339 time to have exactly two ":"' ;
41+ local h = std.toString (std.parseInt (hms[0 ]) + UTCOffset);
42+ local m = hms[1 ];
3943 '%s.%s.%s %s:%s' % [D, M, Y, h, m];
4044
4145local replacementValues = {
0 commit comments