mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-29 11:31:32 +00:00
Fix double date (#4825)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
7224bc625a
commit
aa8dd37d79
@ -33,6 +33,11 @@
|
||||
$: weekMonday = startFromWeekStart
|
||||
? getMonday(currentDate, mondayStart)
|
||||
: new Date(new Date(currentDate).setHours(0, 0, 0, 0))
|
||||
|
||||
function getDate (startDate: Date, dayIndex: number, minutes: number): Date {
|
||||
const date = getDay(startDate, dayIndex)
|
||||
return new Date(date.setMinutes(date.getMinutes() + minutes))
|
||||
}
|
||||
</script>
|
||||
|
||||
<Scroller fade={{ multipler: { top: 3, bottom: 0 } }}>
|
||||
@ -70,7 +75,7 @@
|
||||
{#each [...Array(displayedDaysCount).keys()] as dayIndex}
|
||||
<td class="calendar-td cell" style:height={cellHeight}>
|
||||
{#if $$slots.cell}
|
||||
<slot name="cell" date={getDay(weekMonday, dayIndex, hourOfDay * 60)} />
|
||||
<slot name="cell" date={getDate(weekMonday, dayIndex, hourOfDay * 60)} />
|
||||
{/if}
|
||||
</td>
|
||||
{/each}
|
||||
|
@ -48,8 +48,8 @@ export function getWeekDayName (weekDay: Date, weekFormat: 'narrow' | 'short' |
|
||||
}).format(weekDay)
|
||||
}
|
||||
|
||||
export function day (firstDay: Date, offset: number, minutes?: number): Date {
|
||||
return new Date(firstDay.getTime() + offset * MILLISECONDS_IN_DAY + (minutes ?? 0) * MILLISECONDS_IN_MINUTE)
|
||||
export function day (firstDay: Date, offset: number): Date {
|
||||
return new Date(new Date(firstDay).setDate(firstDay.getDate() + offset))
|
||||
}
|
||||
|
||||
export function weekday (firstDay: Date, w: number, d: number): Date {
|
||||
|
Loading…
Reference in New Issue
Block a user