Skip to content

Commit

Permalink
Fix: #208 날짜 관련 Validation 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Oct 12, 2024
1 parent aa79669 commit 7114f4e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utils/Validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ export default class Validator {
}

public static isWithinDateRange(start: Date | string, end: Date | string, target: Date | string) {
const startDate = DateTime.fromJSDate(new Date(start));
const endDate = DateTime.fromJSDate(new Date(end));
const targetDate = DateTime.fromJSDate(new Date(target));
const startDate = DateTime.fromJSDate(new Date(start)).startOf('day');
const endDate = DateTime.fromJSDate(new Date(end)).startOf('day');
const targetDate = DateTime.fromJSDate(new Date(target)).startOf('day');
return targetDate >= startDate && targetDate < endDate;
}

public static isEarlierStartDate(start: Date | string, end: Date | string) {
const startDate = DateTime.fromJSDate(new Date(start));
const endDate = DateTime.fromJSDate(new Date(end));
const startDate = DateTime.fromJSDate(new Date(start)).startOf('day');
const endDate = DateTime.fromJSDate(new Date(end)).startOf('day');
console.log(startDate.toISODate(), endDate.toISODate());
return startDate <= endDate;
}

Expand Down

0 comments on commit 7114f4e

Please sign in to comment.