api update

This commit is contained in:
tmshv committed 2020-02-15 01:58:42 +03:00
1 parent 502a314c68
commit 99b412ea8d
19 files changed
+684

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import {range} from './common';
/**
*
* @param start
* @returns {*}
*/
export function getDates(start) {
const oneDay = (1000 * 60 * 60 * 24);
const startTime = start.getTime();
const startDay = start.getDay();
return range(0, 6, 1)
.reduce((dates, weekDay) => {
let delta = 1 + weekDay - startDay;
let time = startTime + (oneDay * delta);
return dates.concat([new Date(time)]);
}, [])
.map(i => i.getDate());
}