View source for Module:Japanese calendar
MyWikiBiz, Author Your Legacy — Saturday July 26, 2025
Jump to navigationJump to searchYou do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
-- This module defines an "era" class for processing eras in the Japanese calendar.
-- It also contains functions to export the class properties to #invoke.
local eras = mw.loadData( 'Module:Japanese calendar/data' )
local halfToFull = require( 'Module:Convert character width' ).full -- Converts half-width characters to full-width characters.
--------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------
local function yearToEraIndex( year )
year = tonumber( year )
if type( year ) ~= 'number' then return end
for i, t in ipairs( eras ) do
if year > t.startYear then
return i
elseif year == t.startYear then
if eras[ i + 1 ] and eras[ i + 1 ].startYear == t.startYear then -- This checks for occasions when there were more than two eras in the same year. At the moment, that only applies to the year 686.
return i + 1
else
return i
000
1:0
Templates used on this page:
Return to Module:Japanese calendar.