mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
improve coding style
This commit is contained in:
@@ -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 });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user