2017-05-31 08:26
浏览 214

Laravel - 禁用日期字段中的日期

I'm using a form which includes a date field in Laravel. I would like to disable the weekends and customs dates. For example, the Wednesday 08/11/2017.

Is it possible to do it? I only know how to disable dates before or after a date but not individual dates and I can't find the solution.

My current code:

{!! Form::date('request_date', null, ['class' => 'form-control', 'min' =>  date('Y-m-d')]) !!}

Many thanks.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dtvq4978 2017-05-31 12:09

    As mentioned in the comments use a JS Library. One i use is Bootstrap Datepicker

    You can use the options to disable dates.Docs

    打赏 评论
  • douxunchen3498 2018-09-14 16:26

    You can use Bootstrap Datepicker, but there are a few problems with that, principally in datepicker you can change the format of your date to show it, but when you try to store it, it takes the format that you put it, and if you want to store it in a different format, you must to use a Mutator.

    for example: If you want to show it in a format (dd/mm/yyyy) but you want to store it in a format (yyyy/mm/dd) you need to convert the date.

    打赏 评论

相关推荐 更多相似问题