Level 60
Carbon::parse('first day of January')->format('Y-m-d');
Carbon::parse('last day of December')->format('Y-m-d');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to validate min date and max date to current year
I am using Laravel-5.8 for a web application. I have successfully validate minimum date to the current date as shown below:
<div class="col-12 col-sm-4">
<div class="form-group">
<label class="control-label"> Start Date:<span style="color:red;">*</span></label>
<input type="date" class="form-control" placeholder="dd/mm/yyyy" name="start_date" min="{{Carbon\Carbon::now()->format('Y-m-d')}}">
</div>
</div>
However, I want to validate the minimum date to the start of the current year and maximum date to the end of the current year.
How do I achieve this?
Please or to participate in this conversation.