bersama catatan peribadi & teknikalnya.

#Hijridate

Umm al-Qura Hijri Date
Playing with Javascript

Displaying Gregorian and Hijri today’s date in Arabic format with [1] moment.js and [2] moment-hijri.js in browser:-

<!-- 1- Load the moment-with-locales -->
<script src="/jquery/dist/jquery.min.js"></script>
<script src="/moment/min/moment-with-locales.min.js"></script>
<script src="/moment-hijri/moment-hijri.js"></script>

<script>

// 2- Set the global locale to `ar-SA`
moment.locale('ar-SA');
var m = moment();
// 3- use it normally: ١٤٣٧/٨/١٧هـ الموافق ٢٠١٦/٥/٢٤م
//h = m.format('iYYYY/iM/iDهـ الموافق YYYY/M/Dم');
    hijri = m.format('iD iMMMM iYYYYهـ');
    gr = m.format('LL');
    day = m.format('يوم dddd');
document.getElementById('hijri').innerHTML = hijri;
document.getElementById('gr').innerHTML = gr;
document.getElementById('day').innerHTML = day;

function displayTime() {
        var time = moment().format('s : m : H');
            $('#clock').html(time);
                setTimeout(displayTime, 1000);
}

$(document).ready(function() {
        displayTime();
});

</script>
<div class="ui horizontal inverted divided list">
<div class="item" id="day"></div>
<div class="item" id="gr"></div>
<div class="item" id="hijri"></div>
<div class="item" id="clock"></div>
</div>
<link href="/semantic/dist/semantic.css" rel="stylesheet">

Top