Skip to content

Commit

Permalink
Merge pull request #3807 from JetBrains/ktl-1151-community-today-event
Browse files Browse the repository at this point in the history
fix(KTL-1151): community: event is on the past tab despite it is today
  • Loading branch information
zoobestik authored Nov 14, 2023
2 parents 0d6fdb1 + 53b9c17 commit f9db760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blocks/community/event-list/community-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class CommunityEvent {
this.lang = data.lang || DEFAULT_LANG;
this.content = data.content;
this.startDate = new Date(data.startDate + 'T00:00:00');
this.endDate = new Date(data.endDate + 'T00:00:00');
this.endDate = new Date(data.endDate + 'T23:59:59');
this.formattedDate = formatDate(this.startDate, this.endDate);
}

Expand Down
5 changes: 4 additions & 1 deletion static/js/util/date.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export function formatDate(startDate, endDate) {
let formatted = '';
let year, month, day;
const isRange = startDate.getTime() !== endDate.getTime();
const isRange = (startDate.getDate() !== endDate.getDate() ||
startDate.getMonth() !== endDate.getMonth() ||
startDate.getFullYear() !== endDate.getFullYear()
);
const nowYear = new Date().getFullYear();

const months = [
Expand Down

0 comments on commit f9db760

Please sign in to comment.