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

Ramlashkar's avatar

I have a input of start date, and input of days also, then want store expiry date without $request->input? and with using start date + days in single submit.

I have a input of start date, and input of days also, then want store expiry date without $request->input? and with using start date + days in single submit.

0 likes
7 replies
bobbybouwmann's avatar

Well you need to do the calculation somewhere right? So you either get the numbers from the request or your have to combine the two in the frontend already. You can for example use momentjs for that.

I'm not sure if I understand your question 100%, can you maybe explain a little bit more about it?

Ramlashkar's avatar

Thanks for your understanding. is it possible with Moment.js or any Other?

Snapey's avatar

I don't get what you mean 'without $request->input'

You need to get the input from your user if you want to save it in the database?

Ramlashkar's avatar

Thanks Snapey for your attention,

  1. I have Two inputs with date & days
  2. I have also third input with expiry date. Which i want to calculate date+days with front end or want to store with with backend calculation

Which is better for freshers?

Snapey's avatar

later, do you need to know date and days, or just expiry?

For instance, in two months time, when it reaches expiry, will you need to know that days was 60?

Ramlashkar's avatar

hey snapey,

I want store start date , days and also expiry date i.e.

For Example : Ordered date/Created by customer + transit days for delivery = expected delivery date.

Snapey's avatar

ok so in the controller.


$ordered = Carbon::parse($request->date);

$expected = $ordered->copy()->addDays($request->days);

obviously I don't know any of your field names or what you want to do with the data

Please or to participate in this conversation.