bikram-sambat-bootstrap
Advanced tools
Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "bikram-sambat-bootstrap", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "bikram sambat datepicker for bootstrap", | ||
@@ -26,5 +26,5 @@ "main": "src/bikram-sambat-bootstrap.js", | ||
"dependencies": { | ||
"bikram-sambat": "^1.3.8", | ||
"bikram-sambat": "^1.4.0", | ||
"eurodigit": "^3.1.1" | ||
} | ||
} |
@@ -9,2 +9,24 @@ var bs = require('bikram-sambat'); | ||
function addChangeListener($parent, selecters, onChange) { | ||
if(arguments.length === 1) { | ||
onChange = $parent; | ||
selecters = {}; | ||
$parent = $('body'); | ||
} else if(arguments.length === 2) { | ||
onChange = selecters; | ||
if($parent instanceof jQuery) { | ||
selecters = {}; | ||
} else { | ||
selecters = $parent; | ||
$parent = $('body'); | ||
} | ||
} | ||
$parent.find(selecters.numberInput || '.devanagari-number-input') | ||
.on('input', onChange); | ||
$parent.find(selecters.monthToggle || '.bikram-sambat-input-group .dropdown-menu li a') | ||
.on('click', onChange); | ||
} | ||
function initListeners($parent, selecters) { | ||
@@ -53,10 +75,24 @@ if(arguments.length === 0) { | ||
module.exports = window.bikram_sambat_bootstrap = { | ||
addChangeListener: addChangeListener, | ||
getDate: function($inputGroup) { | ||
// TODO handle fields not set, out of bounds etc. | ||
var year = fieldValue($inputGroup, '[name=year]'); | ||
var month = fieldValue($inputGroup, '[name=month]'); | ||
var day = fieldValue($inputGroup, '[name=day]'); | ||
return bs.toGreg(year, month, day); | ||
try { | ||
return bs.toGreg(year, month, day); | ||
} catch(e) { | ||
return null; | ||
} | ||
}, | ||
getDate_text: function($inputGroup) { | ||
var year = fieldValue($inputGroup, '[name=year]'); | ||
var month = fieldValue($inputGroup, '[name=month]'); | ||
var day = fieldValue($inputGroup, '[name=day]'); | ||
try { | ||
return bs.toGreg_text(year, month, day); | ||
} catch(e) { | ||
return null; | ||
} | ||
}, | ||
initListeners: initListeners, | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15989
251
Updatedbikram-sambat@^1.4.0