mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-05 15:24:22 +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
|
$: weekMonday = startFromWeekStart
|
||||||
? getMonday(currentDate, mondayStart)
|
? getMonday(currentDate, mondayStart)
|
||||||
: new Date(new Date(currentDate).setHours(0, 0, 0, 0))
|
: 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>
|
</script>
|
||||||
|
|
||||||
<Scroller fade={{ multipler: { top: 3, bottom: 0 } }}>
|
<Scroller fade={{ multipler: { top: 3, bottom: 0 } }}>
|
||||||
@ -70,7 +75,7 @@
|
|||||||
{#each [...Array(displayedDaysCount).keys()] as dayIndex}
|
{#each [...Array(displayedDaysCount).keys()] as dayIndex}
|
||||||
<td class="calendar-td cell" style:height={cellHeight}>
|
<td class="calendar-td cell" style:height={cellHeight}>
|
||||||
{#if $$slots.cell}
|
{#if $$slots.cell}
|
||||||
<slot name="cell" date={getDay(weekMonday, dayIndex, hourOfDay * 60)} />
|
<slot name="cell" date={getDate(weekMonday, dayIndex, hourOfDay * 60)} />
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -48,8 +48,8 @@ export function getWeekDayName (weekDay: Date, weekFormat: 'narrow' | 'short' |
|
|||||||
}).format(weekDay)
|
}).format(weekDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function day (firstDay: Date, offset: number, minutes?: number): Date {
|
export function day (firstDay: Date, offset: number): Date {
|
||||||
return new Date(firstDay.getTime() + offset * MILLISECONDS_IN_DAY + (minutes ?? 0) * MILLISECONDS_IN_MINUTE)
|
return new Date(new Date(firstDay).setDate(firstDay.getDate() + offset))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function weekday (firstDay: Date, w: number, d: number): Date {
|
export function weekday (firstDay: Date, w: number, d: number): Date {
|
||||||
|
Loading…
Reference in New Issue
Block a user