Documentation

examples

Basics

Basic Example

Here's a basic example of setting up NepaliDatePicker on an input field:

<!-- Parent element must have a relative position -->
<div class="relative">
    <input type="text" id="date-picker-input">
</div>

<script>
    // Import NepaliDatePicker and styles (if not already imported)
    import NepaliDatePicker from '@anuz-pandey/nepali-date-picker';
    // OR for Vanilla JS Projects
    <script src="path/to/nepali-date-picker.bundle.js"></script>

    // Initialize NepaliDatePicker on the input field
    new NepaliDatePicker('#date-picker-input', {
        format: 'YYYY-MM-DD',
    });
</script>

Format Options

/**
 * Available formats:
 * 'YYYY-MM-DD', 'YYYY/MM/DD', 'YYYY.MM.DD',
 * 'DD-MM-YYYY', 'DD/MM/YYYY', 'DD.MM.YYYY'
 */
new NepaliDatePicker('#date-picker-input', {
    format: 'DD-MM-YYYY',
});
Previous
Usage