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

Melcus's avatar

Date string to moment object mutator

Is there a way to mutate a date string into a moment object ? I need it for daterangepicker

0 likes
1 reply
spekkionu's avatar

Just pass it to the constructor.

moment("{{ $date->format('c') }}");

If your date is a string you might need to provide the format as a second parameter depending on the format.

1 like

Please or to participate in this conversation.