Skip to content

Commit da6ffbd

Browse files
Merge branch 'main' of github.com:andrechristikan/ack-nestjs-mongoose
2 parents d17bea9 + b1c5d9d commit da6ffbd

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/common/helper/services/helper.date.service.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,18 @@ export class HelperDateService implements IHelperDateService {
220220
options?: IHelperDateStartAndEnd
221221
): IHelperDateStartAndEndDate {
222222
const today = moment();
223-
const todayMonth = Number(
224-
today.format(ENUM_HELPER_DATE_FORMAT.ONLY_MONTH)
225-
);
226-
const todayYear = Number(
227-
today.format(ENUM_HELPER_DATE_FORMAT.ONLY_YEAR)
228-
);
229-
223+
const todayMonth = today.format(ENUM_HELPER_DATE_FORMAT.ONLY_MONTH);
224+
const todayYear = today.format(ENUM_HELPER_DATE_FORMAT.ONLY_YEAR);
230225
// set month and year
231226
const year = options?.year ?? todayYear;
232227
const month = options?.month ?? todayMonth;
233228

234-
const date = moment(`${year}-${month}-02`);
229+
const date = moment(`${year}-${month}-02`, 'YYYY-MM-DD');
235230
let startDate: Date = date.startOf('year').toDate();
236231
let endDate: Date = date.endOf('year').toDate();
237232

238233
if (options?.month) {
239-
const date = moment(`${year}-${month}-02`);
234+
const date = moment(`${year}-${month}-02`, 'YYYY-MM-DD');
240235
startDate = date.startOf('month').toDate();
241236
endDate = date.endOf('month').toDate();
242237
}

0 commit comments

Comments
 (0)