Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
f1nality committed May 31, 2024
2 parents 4b2943d + 1845e66 commit 660b8df
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
<link rel="stylesheet" href="styles.b343884ccaaa38fed9cc.css"></head>
<body>
<app-root></app-root>
<script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"></script><script type="text/javascript" src="polyfills.c73631205450cdf588fb.js"></script><script type="text/javascript" src="main.2ff3551e80de372c8c26.js"></script></body>
<script type="text/javascript" src="runtime.a66f828dca56eeb90e02.js"></script><script type="text/javascript" src="polyfills.c73631205450cdf588fb.js"></script><script type="text/javascript" src="main.ea9e8e4f0b1816c22a03.js"></script></body>
</html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion projects/ng-gxdatepicker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-gxdatepicker",
"version": "0.2.8",
"version": "0.2.9",
"description": "Customizable date and time pickers",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
[class.datepicker-calendar__table-cell_another-month]="!day.currentMonth"
[class.datepicker-calendar__table-cell_today]="day.today"
[class.datepicker-calendar__table-cell_range-bound]="day.rangeBound"
[class.datepicker-calendar__table-cell_range-bound-start]="day.rangeBoundStart"
[class.datepicker-calendar__table-cell_range-bound-end]="day.rangeBoundEnd"
[class.datepicker-calendar__table-cell_range-inside]="day.rangeInside"
[class.datepicker-calendar__table-cell_selected]="day.selected"
[class.datepicker-calendar__table-cell_weekend]="day.weekend"
Expand Down
29 changes: 19 additions & 10 deletions projects/ng-gxdatepicker/src/lib/models/month-display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface WeeksDay {
currentMonth: boolean;
weekend: boolean;
rangeBound: boolean;
rangeBoundStart: boolean;
rangeBoundEnd: boolean;
rangeInside: boolean;
selected: boolean;
enabled: boolean;
Expand Down Expand Up @@ -105,25 +107,32 @@ export class MonthDisplay {
this.weeks = range(0, weeks).map(week => {
return range(0, 7).map(day => {
const date = firstDay.clone().add(week, 'weeks').add(day, 'days');
const isSelectedDate = this.selectedDate
&& date.isSame(this.selectedDate, 'day')
&& date.isSame(this.selectedDate, 'month')
&& date.isSame(this.selectedDate, 'year');
const isRangeDate = this.rangeDate
&& date.isSame(this.rangeDate, 'day')
&& date.isSame(this.rangeDate, 'month')
&& date.isSame(this.rangeDate, 'year');
const isSelectedDate = this.selectedDate && this.isSameDay(date, this.selectedDate);
const isRangeDate = this.rangeDate && this.isSameDay(date, this.rangeDate);

return {
date: date,
today: date.isSame(this.now, 'day') && date.isSame(this.now, 'month') && date.isSame(this.now, 'year'),
currentMonth: date.isSame(this.date, 'month') && date.isSame(this.date, 'year'),
today: this.isSameDay(date, this.now),
currentMonth: this.isSameMonth(date, this.date),
weekend: [6, 0].indexOf(date.day()) !== -1,
rangeBound: isRangeDate || (this.rangeDate && isSelectedDate),
rangeBoundStart: rangeDates && this.isSameDay(date, rangeDates[0]),
rangeBoundEnd: rangeDates && this.isSameDay(date, rangeDates[1]),
rangeInside: rangeDates && date.isBetween(rangeDates[0], rangeDates[1], 'date', '()'),
selected: isSelectedDate
};
});
});
}

isSameDay(lhs: moment.Moment, rhs: moment.Moment): boolean {
return lhs.isSame(rhs, 'day')
&& lhs.isSame(rhs, 'month')
&& lhs.isSame(rhs, 'year');
}

isSameMonth(lhs: moment.Moment, rhs: moment.Moment): boolean {
return lhs.isSame(rhs, 'month')
&& lhs.isSame(rhs, 'year');
}
}

0 comments on commit 660b8df

Please sign in to comment.