Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Persian calendar in add form of Laravel

Tags:

php

I want to add date for projects in form. I used this code:

<div class="form-group">
    <label>Finish time</label>
    <input type="date" class="form-control" name="finish_time" id="finish_time">
</div>

How can I create a Persian calendar?

like image 535
hanie Avatar asked Nov 04 '17 19:11

hanie


1 Answers

You should use a javascript package for persian date : here is a good one!

Code Sample:

<link type="text/css" rel="stylesheet" href="css/persianDatepicker.css" />
<script type="text/javascript" src="{{asset('js/jquery.min.js')}}"></script>
<script type="text/javascript" src="js/persianDatepicker.min.js"></script>

<div class="form-group">
    <label>Finish time</label>
    <input type="text" class="form-control" name="finish_time" 
        id="finish_time">
 </div>

<script type="text/javascript">
    $(function() {
        $("#finish_time").persianDatepicker();       
    });
</script>

And use type="text" instead of type="date"

like image 199
Ahmad Mobaraki Avatar answered Nov 13 '22 16:11

Ahmad Mobaraki