Storing the selected date on bootstrap 3 date time picker with meteor


#1

I am using bootstrap 3 date time picker in a meteor application. I am trying to store the selected date so I can use it later. Currently just trying to show the selected date in console. When I run my program I have no errors in my log, however it is also not showing the selected date in the log.

.js

if (Meteor.isClient) {
Template.teetimepicker.onRendered(function() {
this.$(’.datetimepicker’).datetimepicker();
});

function dateSelection(){
var selectedDate = $("#datetimepicker").data(“datetimepicker”).getDate();
console.log(selectedDate);
};
Again I have no console errors but nothing in the log. I need to store the selected date per each user. Thank You for any help!


#2

Hi
And where you call that function to log it ?
I would expect that you need to monitor #datetimepicker element for some event so it knows when to trigger.


#3

I am trying to learn meteor to add to a project I am working on for class. So I am very new and green to it. (meteor is actually an add on nothing that was handled by class). I did call dateSelection(); after the function. Still it wasnt producing anything. I am currently looking at trying to add this to an event template instead. Not sure if I am on the right path. The reason to console.log the dateSelected is only so I know I am capturing it correct. It will be used in a template later. With that being said am I even close?


#4

Also I am looking at the docs for meteor. With the event I am not sure which to call. I don’t believe i want .click since there can be multiple clicks. I just want the final selected date. I am guessing at .data