-1

So I have a reservation program where client can pick two dates. As he picks two dates I need to count how much he will need to pay for those days. For example, he picks 3 days in between then it shows without submitting an order that he needs to pay x amount of money for those days.

I tried refresh button, Javascript and none of that worked for me.

{{ Form::date('date_from', \Carbon\Carbon::now()->format('d-m-Y'), ['class' => 'form-control', 'required' => 'required', 'placeholder' => '']) }}

{{ Form::date('date_to', \Carbon\Carbon::now()->format('d-m-Y'), ['class' => 'form-control', 'required' => 'required']) }}

The expected result is: Client picks 4 days it shows that those 4 days costs x amount of money, so the client can decide how many days he can pick. If he picks 3 days in-between dates, it calculates 3 days price. Formula: days-in-between * price-per-day

Ravi Shankar Bharti
  • 8,922
  • 5
  • 28
  • 52
krmd
  • 3
  • 2

1 Answers1

0

As I can tell from your code, your both dates are picking

Carbon::now

Which returns current date and time, so you're comparing two same dates, and you're probably not getting the result you wanted.

zlatan
  • 3,346
  • 2
  • 17
  • 35