I have a Persian language website and I need to a archive block in my site. but date of default archive view is Gregorian. I install Datex module and it convert all date of nodes to Jalali(Shamsi) Date but can't convert Gregorian date to Jalali Date in archive view. I want to archive content in year+month format. any one has another idea for convert date in archive view?
2 Answers
you can use of persoanTools module persian Tools change calender to jalali and you can use of it in archive and views pages
to display jalali date in drupal, you can do one of the following :
- install persian tools and Calendar Systems and in node.tpl file write the following:
<time datetime="<?php print date('Y-m-d H:i:s', $node->created) ?>"><?php print $date ?></time>
- get timestamp from php, convert it to javascript timestamp and display it using toLocalDateString():
<time datetime="<?php print date('Y-m-d H:i:s', $node->created); ?>"> <span class="publishedon"> <script>let pdate = new Date(<?php print $node->created.'000'; ?>).toLocaleDateString('fa-IR'); jQuery('.publishedon').text(pdate);</script> </span> </time>