Japanese era
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Overview
This module provides the Date formater option that enables the year in a date to be displayed as Japanese era name. For example the year 2012 is the 24th year of the Heisei era and this module provides an option that would display it as "å¹³æˆ24".
Features
- Introduces the "
E" option to be used inside the Format string when creating a new Date and Time format (Configuration > Regional and language > Date and time > Formats, or visit/admin/config/regional/date-time/formats) - When displaying the date the "
E" part outputs the Japanese era name in Japanese alphabet followed by the year number within the era, for example the year 2012 would be displayed as "å¹³æˆ24" - Japanese era names are configurable in this module settings (Configuration > Date API >
Japanese Era, or visit/admin/config/date/japanese_era). Several eras are already set and come with the module but can be changed, and new eras can be added. - It only works on Date fields so far, because it depends on Date API, so it's not recommended to use it in the built-in Date types Long, Medium and Short (so you don't get malformatted "Submitted by" text or similar non-field dates). Instead create a new Date type to use with the format that has the "
E" option.
Requirements
This module depends on Date API module which is a part of the great Date module.
How to install and configure
Provided you already have the Date API module installed and enabled, install Japanese era module the usual way, unpack it in /sites/all/modules and enable it through the interface (Modules, or visit /admin/modules) or use the drush script to download and enable.
- Create a new Date format (Configuration > Regional and language > Date and time > Formats > Add format, or visit
/admin/config/regional/date-time/formats/add) with the "E" representing the year. For example enterE年n月j日as the Format string. - Create a new Date type and set it to use the format you created in step 1. (Configuration > Regional and language > Date and time > Add date type, or visit
/admin/config/regional/date-time/types/add.) In our example set the desired Date type name (for example DateOnly) and chooseE年n月j日under Date format. - Go to the Manage display tab of the content type that contains the Date field you want to format, set the Format for that field to "Date and time", and change the option by clicking on the gear icon on the right and set it to use the Date type you created in Step 1, for example DateOnly (E年n月j日)
Done! Your date field year will now be displayed as å¹³æˆ24. If you use our example the full date will be displayed as å¹³æˆ24å¹´9月26æ—¥ if the date is set to September 26th 2012.
Tutorials
Cookbook: set up Japanese era date on a multilingual site
