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;
49 if (curMonth == 4 || curMonth == 6 || curMonth == 9 || curMonth == 11)
53 var isLeapYear = (curYear % 4 === 0 && curYear % 100 !== 0) || (curYear % 400 ===0);
62 function calDaysX(month, year){
63 if (month == 4 || month == 6 || month == 9 || month == 11)
67 var isLeapYear = (year % 4 === 0 && year % 100 !== 0) || (year % 400 ===0);
81 function lunarTietKhi(){
82 return TIETKHI[getSunLongitude(jd+1,7.0)];
85 function reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich){
86 localdate = new Date();
88 curDay=localdate.getDate();
89 curMonth=localdate.getMonth()+1;
90 curYear=localdate.getFullYear();
92 changeDay(curDay, txtTHU, txtInfo, txtDAYAmLich);
95 function changeDay(newday, txtTHU, txtInfo, txtDAYAmLich){
99 txtTHU.text=__txtTHU_format();
100 txtInfo.text=__txtInfo_format();
101 txtDAYAmLich.text=__txtDAYAmLich_format();
104 function createDateTimeDialog(parent){
105 datetimedlg = createObject("DateTimeDialog.qml", parent);
106 amdatetimedlg = createObject("AmDateTimeDialog.qml", parent);
107 fullmonth = createObject("FullMonth.qml", parent);
110 function __txtTHU_format(){
114 function __txtInfo_format(){
118 function __txtDAYAmLich_format(){
119 return "Ngày <b>"+lunarDay+" ("+lunarDayCanChi+")</b><br>Tháng <b>"+lunarMonth+" ("+lunarMonthCanChi+")</b><br>Năm <b>"+lunarYearInt+" ("+lunarYear+")</b>";
122 function recalculate(){
123 lunarDay = getLunarDate(curDay,curMonth,curYear).day;
124 lunarMonth = getLunarDate(curDay,curMonth,curYear).month;
125 lunarYear = getCanChi(getLunarDate(curDay,curMonth,curYear))[2];
126 lunarYearInt = getLunarDate(curDay,curMonth,curYear).year;
127 jd = getLunarDate(curDay,curMonth,curYear).jd;
128 lunarGioHoangDao = getGioHoangDao(jd);
130 lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
131 lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
133 day_info = get(curDay,curMonth, lunarDay, lunarMonth);
134 isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
137 function createObject(sourceFile, parentObject) {
138 var component = Qt.createComponent(sourceFile);
139 var guiObject = component.createObject(parentObject);
141 if (guiObject === null) {
142 console.log("Error creating object");