Meteor JS : Nice package to create screen components range of dates. (Bootstrap datepicker)

loftsteinn:bootstrap3-daterangepicker

https://atmospherejs.com/loftsteinn/bootstrap3-daterangepicker

http://www.daterangepicker.com/


According to the documentation would just add the package and use it. But with me it didn’t work, I performed the imports inside the application and worked perfectly. I’ll put down a complete example of how I used.

layout.html

<head>
   
    <!-- Include Date Range Picker -->
    <script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/1/daterangepicker.js"></script>
   
    <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/1/daterangepicker-bs3.css" />

</head>

mine.js

Template.SessionEvent.rendered = function(){
    $('.daterange-session').daterangepicker({
        timePicker: true,
        format: 'DD/MM/YYYY h:mm A',
        timePickerIncrement: 5,
        timePickerSeconds: false,
        minDate: moment(),
        ranges: {
            'Today': [moment(), moment()],
            'This Month': [moment().startOf('month'), moment().endOf('month')]
        }
    });
}

mine.html

<template name="SessionEvent">
{...}
        <input type="text" class="form-control daterange-session"/>
{...}
</template>

Screen Shot 2015-07-17 at 3.30.53 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s