Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
How to lay out events in a calendar day view

I'm creating a calendar web application using React (HTML/CSS/JS). I'm trying to figure out how to place events into the calendar in a way that automatically stacks them vertically and horizontally based on their start and end times. Microsoft teams does this in their calendar. I've provided an image here of what the layout should look like.

MS Teams Example

I've tried using flexbox and tried positioning them absolutely based on calculated overlaps and offsets. No luck. Any help would be appreciated!

Thanks!

EDIT: I'm looking for help with the algorithm to do this. Im not looking for specific code.

I have an array of events

[
{start: datetime, end: datetime},
{start: datetime, end: datetime},
...
]

I've created a function that returns a 2x2 matrix of "colisions" between events. E.x. for the pic posted above:

a b c d
a 1 1 0 0
b 1 1 1 0
c 0 1 1 0
d 0 0 0 1

I feel like from this I should be able to determine the width of each event (100%, 50%, 33.3%, etc). and the offset from the left of the page (i.e. column 1, coulmn 2. etc)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda