Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #464

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Dev #464

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libs/upd/components/src/lib/heatmap/heatmap.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ <h2 [id]="'header-' + m" class="month-header">
<ng-container *ngFor="let row of month; let i = index">
<div class="week-row" role="row">
<ng-container *ngFor="let cell of row; let j = index">
<ng-template #defaultTooltip [let-cell]="cell">
<ng-template #defaultTooltip>
{{
cell.date | date: 'longDate' : undefined : currentLang()
cell.date | date: 'longDate' : 'utc' : currentLang()
}}
<hr class="my-1" />
{{ cell.sum | number: '1.0-0' : currentLang() }}
Expand Down Expand Up @@ -67,7 +67,7 @@ <h2 [id]="'header-' + m" class="month-header">
cell.isEmpty
? null
: (cell.date
| date: 'longDate' : undefined : currentLang()) +
| date: 'longDate' : 'utc' : currentLang()) +
', Value: ' +
(cell.sum | number: '1.0-0' : currentLang())
"
Expand Down
10 changes: 6 additions & 4 deletions libs/upd/components/src/lib/heatmap/heatmap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import dayjs from 'dayjs';
import localeData from 'dayjs/plugin/localeData';
import isBetween from 'dayjs/plugin/isBetween';
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
import utc from 'dayjs/plugin/utc';
import { ColumnConfig } from '@dua-upd/types-common';
import { I18nFacade } from '@dua-upd/upd/state';
import { FR_CA } from '@dua-upd/upd/i18n';

dayjs.extend(localeData);
dayjs.extend(isBetween);
dayjs.extend(isSameOrBefore);
dayjs.extend(utc);

interface Cell {
date: string;
Expand Down Expand Up @@ -96,8 +98,8 @@ export class HeatmapComponent<T> {
}

populateCalendarMonths() {
let currentMonth = dayjs(this.data()[0].date).startOf('month');
const endMonth = dayjs(this.data()[this.data().length - 1].date).startOf('month');
let currentMonth = dayjs.utc(this.data()[0].date).startOf('month');
const endMonth = dayjs.utc(this.data()[this.data().length - 1].date).startOf('month');

while (currentMonth.isSameOrBefore(endMonth, 'month')) {
this.calendarMonths.push(this.generateMonthCalendar(currentMonth));
Expand All @@ -112,7 +114,7 @@ export class HeatmapComponent<T> {

for (let day = 1; day <= daysInMonth; day++) {
const currentDay = startOfMonth.add(day - 1, 'day');
const cell = this.data().find(d => dayjs(d.date).isSame(currentDay, 'day'));
const cell = this.data().find(d => dayjs.utc(d.date).isSame(currentDay, 'day'));

if (cell) {
week.push(this.createCell(cell));
Expand Down Expand Up @@ -198,7 +200,7 @@ export class HeatmapComponent<T> {
}

getMonthStartDate(monthIndex: number): string {
return dayjs(this.data()[0].date)
return dayjs.utc(this.data()[0].date)
.add(monthIndex, 'month')
.startOf('month')
.format('YYYY-MM-DD');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
width: 20vw;
left: 45vw;
top: 30%;
z-index: 99;
z-index: 102;
background-color: #fff;
text-align: center;
padding: 20px;
Expand All @@ -99,5 +99,5 @@
position: fixed;
top: 0px;
background-color: rgba(0, 0, 0, 0.5);
z-index: 98;
z-index: 101;
}
Loading