「モジュール:ヨーグレキ」の版間の差分

ヨーグ前に対応
(やっぱりいろいろ使いたい)
(ヨーグ前に対応)
 
19行目: 19行目:


local function isYogurianValidDate(yYear, yMonth, yDay)
local function isYogurianValidDate(yYear, yMonth, yDay)
     return yMonth > 0 and yMonth <= 12 and yDay > 0 and yDay <= 30 +
     return yYear ~= 0 and yMonth > 0 and yMonth <= 12 and yDay > 0 and yDay <= 30 +
               (yMonth == 1 and (isLeap(yYear + 2020) and 6 or 5) or 0)
               (yMonth == 1 and (isLeap(yYear + 2020) and 6 or 5) or 0)
end
end
67行目: 67行目:
     ym = dfn <= hmd and 1 or math.floor((dfn - hmd - 1) / 30) + 2
     ym = dfn <= hmd and 1 or math.floor((dfn - hmd - 1) / 30) + 2
     yd = ym == 1 and dfn or (dfn - hmd - 1) % 30 + 1
     yd = ym == 1 and dfn or (dfn - hmd - 1) % 30 + 1
    yy = yy < 1 and yy - 1 or yy
     return {yy, ym, yd}
     return {yy, ym, yd}
end
end
72行目: 73行目:
local function yogurianToGregorian(yYear, yMonth, yDay)
local function yogurianToGregorian(yYear, yMonth, yDay)
     checkYogurianValidDate(yYear, yMonth, yDay)
     checkYogurianValidDate(yYear, yMonth, yDay)
    yYear = yYear < 0 and yYear + 1 or yYear
     isLeapB = isLeap(yYear + 2020)
     isLeapB = isLeap(yYear + 2020)
     gDay = yMonth == 1 and yDay or (yMonth - 2) * 30 + (isLeapB and 36 or 35) + yDay
     gDay = yMonth == 1 and yDay or (yMonth - 2) * 30 + (isLeapB and 36 or 35) + yDay