fix(datetime): respect time limits in hours and minutes

fixes #6850
This commit is contained in:
Manu Mtz.-Almeida
2017-03-15 23:30:08 +01:00
parent e191321193
commit afd99baba0
5 changed files with 220 additions and 200 deletions

View File

@@ -150,13 +150,13 @@ export function dateValueRange(format: string, min: DateTimeData, max: DateTimeD
return opts;
}
export function dateSortValue(year: number, month: number, day: number): number {
return parseInt(`1${fourDigit(year)}${twoDigit(month)}${twoDigit(day)}`, 10);
export function dateSortValue(year: number, month: number, day: number, hour: number = 0, minute: number = 0): number {
return parseInt(`1${fourDigit(year)}${twoDigit(month)}${twoDigit(day)}${twoDigit(hour)}${twoDigit(minute)}`, 10);
}
export function dateDataSortValue(data: DateTimeData): number {
if (data) {
return dateSortValue(data.year, data.month, data.day);
return dateSortValue(data.year, data.month, data.day, data.hour, data.minute);
}
return -1;
}

View File

@@ -63,25 +63,25 @@ export function defaults(dest: any, ...args: any[]) {
/** @private */
export function isBoolean(val: any) { return typeof val === 'boolean'; }
export function isBoolean(val: any): val is boolean { return typeof val === 'boolean'; }
/** @private */
export function isString(val: any) { return typeof val === 'string'; }
export function isString(val: any): val is string { return typeof val === 'string'; }
/** @private */
export function isNumber(val: any) { return typeof val === 'number'; }
export function isNumber(val: any): val is number { return typeof val === 'number'; }
/** @private */
export function isFunction(val: any) { return typeof val === 'function'; }
export function isFunction(val: any): val is Function { return typeof val === 'function'; }
/** @private */
export function isDefined(val: any) { return typeof val !== 'undefined'; }
export function isDefined(val: any): boolean { return typeof val !== 'undefined'; }
/** @private */
export function isUndefined(val: any) { return typeof val === 'undefined'; }
export function isUndefined(val: any): val is undefined { return typeof val === 'undefined'; }
/** @private */
export function isPresent(val: any) { return val !== undefined && val !== null; }
export function isPresent(val: any): val is any { return val !== undefined && val !== null; }
/** @private */
export function isBlank(val: any) { return val === undefined || val === null; }
export function isBlank(val: any): val is null { return val === undefined || val === null; }
/** @private */
export function isObject(val: any) { return typeof val === 'object'; }
export function isObject(val: any): val is Object { return typeof val === 'object'; }
/** @private */
export function isArray(val: any) { return Array.isArray(val); };
export function isArray(val: any): val is any[] { return Array.isArray(val); };
/** @private */