3 Qt.include("amlich-hnd.js");
4 Qt.include("amlich-aa98.js");
5 Qt.include("Settings.js");
6 Qt.include("Themes.js");
7 Qt.include("CacNgayLeTrongNam.js");
8 Qt.include("xemngaytotxau.js");
10 var localdate = new Date();
12 var curDay=localdate.getDate();
13 var curMonth=localdate.getMonth()+1;
14 var curYear=localdate.getFullYear();
20 var lunarDay = getLunarDate(curDay,curMonth,curYear).day;
21 var lunarMonth = getLunarDate(curDay,curMonth,curYear).month;
22 var lunarYear = getCanChi(getLunarDate(curDay,curMonth,curYear))[2];
23 var lunarYearInt = getLunarDate(curDay,curMonth,curYear).year;
24 var jd = getLunarDate(curDay,curMonth,curYear).jd;
25 var lunarGioHoangDao = getGioHoangDao(jd);
27 var lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
28 var lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
30 var day_info = get(curDay,curMonth, curYear, lunarDay, lunarMonth);
31 var isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
39 initcurMonth = curMonth;
40 initcurYear = curYear;
48 if (curMonth == 4 || curMonth == 6 || curMonth == 9 || curMonth == 11)
52 var isLeapYear = (curYear % 4 === 0 && curYear % 100 !== 0) || (curYear % 400 ===0);
61 function calDaysX(month, year){
62 if (month == 4 || month == 6 || month == 9 || month == 11)
66 var isLeapYear = (year % 4 === 0 && year % 100 !== 0) || (year % 400 ===0);
79 function lunarTietKhi(){
80 return TIETKHI[getSunLongitude(jd+1,7.0)];
83 function reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich){
84 localdate = new Date();
86 curDay=localdate.getDate();
87 curMonth=localdate.getMonth()+1;
88 curYear=localdate.getFullYear();
90 changeDay(curDay, txtTHU, txtInfo, txtDAYAmLich);
93 function changeDay(newday, txtTHU, txtInfo, txtDAYAmLich){
97 txtTHU.text=__txtTHU_format();
98 txtInfo.text=__txtInfo_format();
99 txtDAYAmLich.text=__txtDAYAmLich_format();
102 function createDateTimeDialog(parent){
103 datetimedlg = createObject("DateTimeDialog.qml", parent);
104 amdatetimedlg = createObject("AmDateTimeDialog.qml", parent);
105 fullmonth = createObject("FullMonth.qml", parent);
108 function __txtTHU_format(){
112 function __txtInfo_format(){
116 function __txtDAYAmLich_format(){
117 return "Ngày <b>"+lunarDay+" ("+lunarDayCanChi+")</b><br>Tháng <b>"+lunarMonth+" ("+lunarMonthCanChi+")</b><br>Năm <b>"+lunarYearInt+" ("+lunarYear+")</b>";
120 function recalculate(){
121 lunarDay = getLunarDate(curDay,curMonth,curYear).day;
122 lunarMonth = getLunarDate(curDay,curMonth,curYear).month;
123 lunarYear = getCanChi(getLunarDate(curDay,curMonth,curYear))[2];
124 lunarYearInt = getLunarDate(curDay,curMonth,curYear).year;
125 jd = getLunarDate(curDay,curMonth,curYear).jd;
126 lunarGioHoangDao = getGioHoangDao(jd);
128 lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
129 lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
131 day_info = get(curDay,curMonth, lunarDay, lunarMonth);
132 isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
135 function createObject(sourceFile, parentObject) {
136 var component = Qt.createComponent(sourceFile);
137 var guiObject = component.createObject(parentObject);
139 if (guiObject === null) {
140 console.log("Error creating object");