updates to url controller, filter and form elements

This commit is contained in:
rlx 2011-11-10 19:52:26 +00:00
commit 07c79ed7ac
7 changed files with 162 additions and 79 deletions

View file

@ -278,16 +278,20 @@ Ox.parseDate = function(str, utc) {
var date = new Date(0),
defaults = [, 1, 1, 0, 0, 0],
values = /(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(str);
values.shift();
values = values.map(function(v, i) {
return v || defaults[i];
});
values[1]--;
[
'FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'
].forEach(function(part, i) {
Ox['set' + part](date, values[i], utc);
});
if (values) {
values.shift();
values = values.map(function(v, i) {
return v || defaults[i];
});
values[1]--;
[
'FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'
].forEach(function(part, i) {
Ox['set' + part](date, values[i], utc);
});
} else {
date = null;
}
return date;
};

View file

@ -548,6 +548,7 @@ Ox.formatValue = function(num, str, bin) {
/*@
Ox.formatUnit <f> Formats a number with a unit
@*/
Ox.formatUnit = function(num, str) {
return Ox.formatNumber(num, 3) + ' ' + str;
Ox.formatUnit = function(num, str, dec) {
dec = Ox.isUndefined(dec) ? 3 : dec;
return Ox.formatNumber(num, dec) + (str == '%' ? '' : ' ') + str;
};