Closed mkkmail closed 8 years ago
<script src="js/jquery-2.1.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/datepicker/moment.min.js"></script>
<script src="js/datepicker/moment-jalaali.js"></script>
<script src="js/datepicker/fa.js"></script>
<script src="js/datepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
$(function () {
var dateNow = new Date();
$('#datetimepicker2,#datetimepicker3').datetimepicker({
locale: 'fa',
defaultDate:dateNow,
format: 'YYYY-MM-DD'
});
});
</script>
<script>
moment().format('jYYYY/jM/jD')
</script>
Other people tried to do something similar, but I think they were not successful. The problem is that currently, moment-jalaali
adds an additional API beside moment
's api. So if you want to convert a date picker, you have to change all the places where it has used moment
to use the similar (but a little different) API of moment-jalaali
.
In the near future, I will try to change moment-jalaali
, so this type of usage will be a lot simpler.
Thanks for answer Dear Behrang, but i'm confused, can you explain more or give me an example of moment jallali usage, i also want to use it to convert xaxis time in flot chart js (https://github.com/flot/flot). Thanks for time best regards
Mose calendars use moment
methods like year
, month
, and date
, but if you want Jalaali version, currently they are named jYear
, jMonth
, and jDate
. So you may need a substantial rewrite of date pickers source code to convert them.
In the near future, I may change the API so that method names will remain the same, but a flag will switch to different calendar system. This way, there will be no need to change date pickers.
Also, on the home page, there are some examples.
Hi, Thanks for Great Plugin, very usefull, i want to use this for below plugin, but when i call js to project code, after click on calendar button my browser is going to stop, https://github.com/Eonasdan/bootstrap-datetimepicker
can you help me. best regards.