Skip to content

Commit ebcd87f

Browse files
Merge pull request #9 from sanishmaharjan/master
Month range change from 0-11 to 1-12
2 parents 1047dbf + bffe4b6 commit ebcd87f

File tree

6 files changed

+375
-156
lines changed

6 files changed

+375
-156
lines changed

demo/demo.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $(document).ready(function () {
55
});
66

77
var currentDate = new Date();
8-
var currentNepaliDate = calenderFunctions.getBsDateByAdDate(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
8+
var currentNepaliDate = calenderFunctions.getBsDateByAdDate(currentDate.getFullYear(), currentDate.getMonth() + 1, currentDate.getDate());
99
var formatedNepaliDate = calenderFunctions.bsDateFormat("%y-%m-%d", currentNepaliDate.bsYear, currentNepaliDate.bsMonth, currentNepaliDate.bsDate);
1010
$("#from-picker").nepaliDatePicker({
1111
dateFormat: "%y-%m-%d",
@@ -46,7 +46,7 @@ $(document).ready(function () {
4646
});
4747

4848
$("#date-picker").on("yearChange", function (event) {
49-
49+
eventLog(event);
5050
});
5151

5252
$("#date-picker").on("monthChange", function (event) {
@@ -57,6 +57,10 @@ $(document).ready(function () {
5757
eventLog(event);
5858
});
5959

60+
$("#date-picker").on("dateSelect", function (event) {
61+
eventLog(event);
62+
});
63+
6064
$("#clear-bth").on("click", function (event) {
6165
$(".bod-picker").val('');
6266
});
@@ -85,17 +89,11 @@ $(document).ready(function () {
8589
log('calenderFunctions.getBsYearByAdDate(2017, 2, 15);', false);
8690
log(calenderFunctions.getBsYearByAdDate(2017, 2, 15), true);
8791

88-
log('calenderFunctions.getBsYearByAdDate(2017, 2, 15);', false);
89-
log(calenderFunctions.getBsYearByAdDate(2017, 2, 15), true);
90-
9192
log('calenderFunctions.getBsMonthByAdDate(2017, 2, 15);', false);
9293
log(calenderFunctions.getBsMonthByAdDate(2017, 2, 15), true);
9394

94-
log('calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3);', false);
95-
log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3), true);
96-
97-
log('calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3);', false);
98-
log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3), true);
95+
log('calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9);', false);
96+
log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9), true);
9997

10098
log('calenderFunctions.parseFormattedBsDate("%y %M, %d %D", "२०७४ चैत, ९ बुध");', false);
10199
log(calenderFunctions.parseFormattedBsDate("%y %M, %d %D", "२०७४ चैत, ९ बुध"), true);

demo/index.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h3><u>How to use it?</u></h3>
1616
<legend>HTML Code</legend>
1717
<pre>
1818
&lt;p&gt;
19-
&lt;label>BOD: &lt;/label&gt;
19+
&lt;label>DOB: &lt;/label&gt;
2020
&lt;input type="text" value="" name="date" class="bod-picker" placeholder="Select Date of Birth"&gt;
2121
&lt;button id="clear-bth" onclick="">Clear&lt;/button&gt;
2222
&lt;/p&gt;
@@ -45,7 +45,7 @@ <h3><u>How to use it?</u></h3>
4545
<fieldset class="demo fix-height">
4646
<legend>Demo</legend>
4747
<p>
48-
<label>BOD: </label>
48+
<label>DOB: </label>
4949
<input type="text" value="" name="date" class="bod-picker" placeholder="Select Date of Birth">
5050
<button id="clear-bth" onclick="">Clear</button>
5151
</p>
@@ -165,21 +165,21 @@ <h3><u>Options</u></h3>
165165
<legend>JS Code</legend>
166166
<pre>
167167
var currentDate = new Date();
168-
var currentNepaliDate = calenderFunctions.getBsDateByAdDate(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
169-
var formatedNepaliDate = calenderFunctions.bsDateFormat("%y-%m-%d",currentNepaliDate.bsYear, currentNepaliDate.bsMonth, currentNepaliDate.bsDate);
168+
var currentNepaliDate = calenderFunctions.getBsDateByAdDate(currentDate.getFullYear(), currentDate.getMonth() + 1, currentDate.getDate());
169+
var formatedNepaliDate = calenderFunctions.bsDateFormat("%y-%m-%d", currentNepaliDate.bsYear, currentNepaliDate.bsMonth, currentNepaliDate.bsDate);
170170
$("#from-picker").nepaliDatePicker({
171171
dateFormat: "%y-%m-%d",
172172
closeOnDateSelect: true,
173-
minDate : "२०७०-१-२०",
174-
maxDate : formatedNepaliDate
173+
minDate: "२०७०-१-२०",
174+
maxDate: formatedNepaliDate
175175
});
176176

177177
$("#to-picker").val(formatedNepaliDate);
178178
$("#to-picker").nepaliDatePicker({
179179
dateFormat: "%y-%m-%d",
180180
closeOnDateSelect: true,
181-
minDate : "२०७०-१-२०", <span class="comment">//should be formated as dateFormat option set </span>
182-
maxDate : formatedNepaliDate
181+
minDate: "२०७०-१-२०",
182+
maxDate: formatedNepaliDate
183183
});
184184
</pre>
185185
</fieldset>
@@ -223,7 +223,7 @@ <h3><u>Event Handler:</u></h3>
223223
</tr>
224224
<tr>
225225
<td>
226-
select
226+
dateSelect
227227
</td>
228228
<td>
229229
Event trigger on select date
@@ -292,7 +292,7 @@ <h3><u>Event Handler:</u></h3>
292292
});
293293

294294
$("#date-picker").on("yearChange", function (event) {
295-
295+
eventLog(event);
296296
});
297297

298298
$("#date-picker").on("monthChange", function (event) {
@@ -302,6 +302,10 @@ <h3><u>Event Handler:</u></h3>
302302
$("#date-picker").on("dateChange", function (event) {
303303
eventLog(event);
304304
});
305+
306+
$("#date-picker").on("dateSelect", function (event) {
307+
eventLog(event);
308+
});
305309
</pre>
306310
</fieldset>
307311
</div>
@@ -329,13 +333,13 @@ <h3><u>API:</u></h3>
329333
</li>
330334
<li>
331335
Month start form 0 index <br/>
332-
<span class="comment">0: January | बैशाख</span><br/>
333-
<span class="comment">11: December | चैत</span><br/>
336+
<span class="comment">1: January | बैशाख</span><br/>
337+
<span class="comment">12: December | चैत</span><br/>
334338
</li>
335339
<li>
336340
Week Day start form 0 index <br/>
337-
<span class="comment">0: Sunday | आईत</span><br/>
338-
<span class="comment">6: Saturday | शनि</span><br/>
341+
<span class="comment">1: Sunday | आईत</span><br/>
342+
<span class="comment">7: Saturday | शनि</span><br/>
339343
</li>
340344
</ul>
341345
</p>
@@ -635,13 +639,9 @@ <h3><u>API:</u></h3>
635639

636640
console.log(calenderFunctions.getBsYearByAdDate(2017, 2, 15));
637641

638-
console.log(calenderFunctions.getBsYearByAdDate(2017, 2, 15));
639-
640642
console.log(calenderFunctions.getBsMonthByAdDate(2017, 2, 15));
641643

642-
console.log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3));
643-
644-
console.log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9, 3));
644+
console.log(calenderFunctions.bsDateFormat("%y %M, %d %D", 2074, 11, 9));
645645

646646
console.log(calenderFunctions.parseFormattedBsDate("%y %M, %d %D", "२०७४ चैत, ९ बुध"));
647647
</pre>

dist/jquery.nepaliDatePicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nepali-date-picker",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"authors": [
55
"Sanish Maharjan <[email protected]>"
66
],

0 commit comments

Comments
 (0)