Date Widget : Show Today’s Nepali Date in your website

Notice: This widget has been deprecated. This post is only kept for historical purpose. You can checkout code in Github if your want to implement it yourself.

Overview

DateJS (Date Widget) is a simple javascript widget to display today’s Nepali date in your site. If you want to display date in Bikram Sambat (BS) dynamically, then its easy now. This widget will do that job. You can either show date in English language or in Nepali unicode. It can be configuration easily. Different date formats are available. See Settings section for available date formats. It is not necessary to include any javascript library for using this widget.

Features

  • Simple and easy to install
  • Customizable
  • Supports display language; English or Nepali
  • Various date formats
  • Supports time also
  • Time may be in 24hr or 12hr format
  • Supports multiple instance in single page

How To

Intalling this widget is very easy. You just need to copy given code and after customizing it, paste it to your web page. If you are using any CMS or blogging service then paste it in Text/Html widget.
Basic Installation

<script src="http://nilambar.com.np/dateapi/widget.js"></script> 
<script id="mywidget">
DateJS.Widget();
</script>

Advanced Installation

<script src="http://nilambar.com.np/dateapi/widget.js"></script> 
<script id="mydatewidget">
DateJS.Widget({  
  dateLanguage : 'np',
  dateFormat : 6,
  showPoweredBy : true,
  widgetId : 'mydatewidget'
});
</script>

Example

To see demo, check sidebar of this blog. ЁЯЩВ

Settings

Property Default Description
dateLanguage ‘np’ Language to display date. Either ‘en’ or ‘np’.
Example :
np : резреп рд╕рд╛рдЙрди реирежремреп, рд╢реБрдХреНрд░рдмрд╛рд░
en : 19 Shrawan 2069, Friday
dateFormat 6 Integer value assigned for various date formats.
Example:
1 : резреп режрек реирежремреп
2 : реирежремреп резреп режрек
3 : реирежремреп режрек резреп
4 : резреп рд╕рд╛рдЙрди реирежремреп
5 : реирежремреп рд╕рд╛рдЙрди резреп
6 : резреп рд╕рд╛рдЙрди реирежремреп, рд╢реБрдХреНрд░рдмрд╛рд░
7 : рд╢реБрдХреНрд░рдмрд╛рд░, резреп рд╕рд╛рдЙрди реирежремреп
8 : реирежремреп рд╕рд╛рдЙрди резреп, рд╢реБрдХреНрд░рдмрд╛рд░
9 : рд╢реБрдХреНрд░рдмрд╛рд░, реирежремреп рд╕рд╛рдЙрди резреп
widgetId ‘mywidget’ ID of the widget. If you are using single widget in a page then no need to set this option.
For multiple widgets, assign different name to each script’s ID and pass that in this parameter.
dateSeparator ‘ ‘ (space) Date separator. Default is space. You may use ‘-‘, ”, ‘/’.
showTime true Option to whether display time or not. Enter false to disable
militaryTime false true will show time in 24 HOUR format. false for 12 HOUR format
showTimeBeforeDate false Show time after date if false. Use true if you want to display time before date.
multiLine false Set to true if you want to display date and time in separate line.
showPoweredBy true Enable of disable the banner display below the date. Setting false will disable it. [ I would appreciate if you enable banner ЁЯШЫ ]

Thanks to Jonathan Julian for his example_javascript_widget using which I was able to make this widget. And also kudos to codeartsnepal for Nepali-English Date conversion PHP class.

5 thoughts on “Date Widget : Show Today’s Nepali Date in your website

  1. working fine for single widget.. but multiple widget
    doesn't support…What is the solution

Leave a Reply

Your email address will not be published. Required fields are marked *