Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Japanese calendar/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== From another Lua module === First of all, the era class must be loaded, like this: * <code lang="lua">local era = require( 'Module:Japanese calendar' ).era</code> Once the class is loaded, you can make a new era object using <code>era:new()</code>: * <code lang="lua>local myEra = era:new{ year = ''year'', era = ''article name or kanji'' }</code> Either <code>''year''</code> or <code>''era''</code> must be specified. It is also possible to use an <code>index</code> field, corresponding to the index of [[Module:Japanese calendar/data]], but this is for internal use only and will change as new eras are added. ==== Properties ==== Era objects have a number of properties. Their values might be <code>nil</code> if the module did not have enough information to process them, or the values could be <code>false</code> if they correspond to an invalid era. You can specify properties with the dot syntax: * <code lang="lua">local article = myEra.article</code> The properties are as follows: * <code>gregorianYear</code>: the year in the [[Gregorian calendar]]. Same as the input year. * <code>startYear</code>: the first year of the specified era. * <code>endYear</code>: the last year of the specified era. * <code>eraYear</code>: the year of the specified era, without the era name. * <code>eraYearKanji</code>: a string representing the era year in [[kanji]]. The first year of an era is changed to the kanji ε , and the others are changed to [[Halfwidth and fullwidth forms|full-width]] numbers. Note: even though the output may often look like a number, it will always be a string value. * <code>article</code>: the Wikipedia article for the era, unlinked. * <code>label</code>: the name of the era. Same as <code>article</code> unless the article title is [[WP:DAB|disambiguated]]. * <code>kanji</code>: the name of the era in kanji. ==== Methods ==== Era objects have three methods. Methods can be specified with the colon syntax: * <code lang="lua">local nextEra = myEra:getNextEra()</code> The methods are as follows: * <code lang="lua">era:getNextEra()</code> - gets the era object for the next era. Returns <code>nil</code> if it doesn't exist. * <code lang="lua">era:getPreviousEra()</code> - gets the era object for the previous era. Returns <code>nil</code> if it doesn't exist. * <code lang="lua">era:getOldEra()</code> - gets the era object for the "old" era. This is the same as the current era object unless eraYear equals 1. If eraYear equals 1 then this returns the era object for the previous era. If the module could not find a valid previous era object then the current era object is returned. <includeonly>{{Sandbox other|| [[Category:Time, date and calendar modules]] }}</includeonly><noinclude> [[Category:Module documentation pages]] </noinclude>
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)