231801_test_to_master #1519

Merged
alexm merged 490 commits from 231801_test_to_master into master 2023-05-12 06:29:59 +00:00
2 changed files with 37 additions and 2 deletions
Showing only changes of commit bc47fc35d6 - Show all commits

View File

@ -46,11 +46,11 @@ export default class Controller extends Section {
}, },
{ {
field: 'created', field: 'created',
searchable: false datepicker: true
}, },
{ {
field: 'defaulterSinced', field: 'defaulterSinced',
searchable: false datepicker: true
} }
] ]
}; };
@ -136,8 +136,25 @@ export default class Controller extends Section {
case 'workerFk': case 'workerFk':
case 'salesPersonFk': case 'salesPersonFk':
return {[`d.${param}`]: value}; return {[`d.${param}`]: value};
case 'created':
return {'d.created': {
between: this.dateRange(value)}
};
case 'defaulterSinced':
return {'d.defaulterSinced': {
between: this.dateRange(value)}
};
} }
} }
dateRange(value) {
const minHour = new Date(value);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(value);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
}
} }
ngModule.vnComponent('vnClientDefaulter', { ngModule.vnComponent('vnClientDefaulter', {

View File

@ -117,5 +117,23 @@ describe('client defaulter', () => {
expect(controller.balanceDueTotal).toEqual(875); expect(controller.balanceDueTotal).toEqual(875);
}); });
}); });
describe('dateRange()', () => {
it('should return two dates with the hours at the start and end of the given date', () => {
const now = Date.vnNew();
const today = now.getDate();
const dateRange = controller.dateRange(now);
const start = dateRange[0].toString();
const end = dateRange[1].toString();
expect(start).toContain(today);
expect(start).toContain('00:00:00');
expect(end).toContain(today);
expect(end).toContain('23:59:59');
});
});
}); });
}); });