UNPKG

@narmafzam/jalali-datepicker

Version:

just a jalali-datepicker

34 lines (31 loc) 1.05 kB
// require('../css/jalali-datepicker.scss'); let Model = require('./model'); (function ($) { $.fn.jalalidatepicker = $.fn.jDatepicker = function (options) { let args = Array.prototype.slice.call(arguments), output = null, self = this; if (!this) { $.error('Invalid selector'); } $(this).each(function () { // encapsulation Args let emptyArr = [], tempArg = args.concat(emptyArr), dp = $(this).data('datepicker'), funcName = null; if (dp && typeof tempArg[0] === 'string') { funcName = tempArg[0]; output = dp[funcName](tempArg[0]); } else { self.pDatePicker = new Model(this, options); } }); $(this).data('datepicker', self.pDatePicker); return self.pDatePicker; }; })(jQuery); const jalalidatepicker = function (selector, options) { jQuery(selector).jalalidatepicker(options); }; export { jalalidatepicker }