2017-6-5 Monday
One of the requirements today is: The two-tax levy module enters the page filter time default is the current month of the previous one months, and according to the filter results display data, we use the framework of MINIUI.
Pit 1:
Default settings, just touch miniui, on the inside of the usage and operation is not familiar with, so I directly use jquery to find the time input box, set its Val attribute, found not to take effect, and later found that the data involved MINIUI to use MINIUI to provide the method. Set the default value code as follows:
//设置id为month2的input框的默认值mini.get(‘month2‘).setValue(nowDate);
Pit 2:
JS time to get the problem, get the month is to get the month is 0-11, if want to get the current month to do +1 operation, but my demand is to get last month, so do not have to do, for 0 when set to 12 can be:
var date = new Date();var month = date.getMonth();month = ((month == 0) ? (12) : (month));
Get the year's time more pit, according to the inertial thinking, get the month with getmonth, that get the year not to use getyear, then I really admire my small wit, the result of the problem came, output is not 2017, but 117, the reason for this problem I think may be when JS was born (92) , the browser standard has not been unified, resulting in getyear conversion rules in the current standard does not apply. Instead, the following is:
var year = date.getFullYear();
Pit 3:
If the field you want to query is null in an SQL query, but you want it to be null, how do i show a default value?
//有值为SUM(G_ZZS),为null显示0nvl(SUM(G_ZZS),0)
?
MINIUI input Set default value, JS get year month notice, database NVL function use