Calendar-Converter is a simple plug-in that may only be used by Chinese applications or websites. The plug-in function is to convert the date and time between the Gregorian Calendar and the lunar Calendar.
Example
First introduce the plug-in file
<Script src = "js/calendar-converter.js"> </script>
Then instantiate the plug-in object and pass a time object.
Var cc = new CalendarConverter;
Cc. solar2lunar (new Date (2011, 0, 3); ---> 2010,11, 29
Cc. lunar2solar (new Date (2010, 10, 29); ----> 2011, 1, 3
If the lunar calendar is converted to the Gregorian calendar, if January is the leap month of that year, an additional parameter is required to obtain the correct Gregorian calendar date.
Cc. solar2lunar (new Date (2012, 4, 27); ---> 7 at the beginning of May 2012, where isLeap is true, which indicates April
Cc. lunar2solar (new Date (2012, 3, 7) ---> error Time: 2012, 4, 27
Cc. lunar2solar (new Date (2012, 3, 7), true) --> correct: 2012, 5, 27
Optional parameter
Result :{
CDay: "Wuyun"
, CMonth: "Ding Wei"
, CYear: "Chen"
, IsLeap: false // whether the month is a leap month
, LDay: 18
, LMonth: 6
, LYear: 2012
, LunarDay: "18"
, LunarFestival :""
, LunarMonth: "6"
, LunarYear: "Dragon"
, SDay: 5
, SMonth: 8
, SYear: 2012, solarFestival: "// Festival (Festivals)
, SolarTerms: "" // solar saving
, Week: "day" // day of the week
}