improve coding style

This commit is contained in:
Alys
2015-11-22 11:05:03 +10:00
parent a380c1aa30
commit 728a94d199

View File

@@ -4,8 +4,7 @@
------------------------------------------------------ ------------------------------------------------------
*/ */
import _ from 'lodash'; import _ from 'lodash';
import moment from 'moment';
let moment = require('moment');
export const DAY_MAPPING = { export const DAY_MAPPING = {
0: 'su', 0: 'su',
@@ -38,10 +37,7 @@ export function sanitizeOptions (o) {
}; };
} }
export function startOfWeek (options) { export function startOfWeek (options = {}) {
if (options === null) {
options = {};
}
let o = sanitizeOptions(options); let o = sanitizeOptions(options);
return moment(o.now).startOf('week'); return moment(o.now).startOf('week');
@@ -54,10 +50,7 @@ export function startOfWeek (options) {
This is NOT suitable for manipulating any dates that are displayed to the user as a date with no time portion, such as a Daily's Start Dates (e.g., a Start Date of today shows only the date, so it should be considered to be today even if the hidden time portion is before CDS). This is NOT suitable for manipulating any dates that are displayed to the user as a date with no time portion, such as a Daily's Start Dates (e.g., a Start Date of today shows only the date, so it should be considered to be today even if the hidden time portion is before CDS).
*/ */
export function startOfDay (options) { export function startOfDay (options = {}) {
if (options === null) {
options = {};
}
let o = sanitizeOptions(options); let o = sanitizeOptions(options);
let dayStart = moment(o.now).startOf('day').add({ hours: o.dayStart }); let dayStart = moment(o.now).startOf('day').add({ hours: o.dayStart });