Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pokeycam's avatar

Date Menu using Livewire

Hi,

I need help in creating a menu using Livewire.

I'm creating a timesheet application, and I want to load up the time entry page on the current day, but then have a menu at the top so I can go backwards and forwards (not past the current day). Something like this:

<- 17 June 2020 ->

I'm a little stuck on where to start with this one. If anyone has any examples that would be helpful.

0 likes
2 replies
CorvS's avatar

Two "arrow" buttons which de-/increase the current date by one day (with the mentioned constraint) and your component renders the entries for that specific date. Pretty straight forward I'd say.

prospero's avatar
prospero
Best Answer
Level 3

You can have a public property (eg. $selectedDate) by default having the now()->today() value. The buttons in both sides is going to sub from that value, I mean for left button (before day) now()->today()->subDays(1) and the right to add days now()->today()->addDays(1).

Please or to participate in this conversation.