GithubHelp home page GithubHelp logo

meteor-community-packages / meteor-autoform-bs-datetimepicker Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 30.0 15 KB

Custom bootstrap-datetimepicker input type with timezone support for AutoForm

License: MIT License

HTML 2.17% JavaScript 97.83%
autoform blaze hacktoberfest meteor

meteor-autoform-bs-datetimepicker's People

Contributors

aldeed avatar comerc avatar ghaliano avatar jankapunkt avatar kaoskeya avatar storytellercz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-autoform-bs-datetimepicker's Issues

v4beta support now

https://github.com/comerc/meteor-autoform-bs-datetimepicker/tree/v4beta

It solved my problems with modal dialog, Opera and much more (datepicker should burn in hell)

Prerequisites

$ meteor add comerc:bs-datetimepicker
$ cd packages
$ git clone https://github.com/comerc/meteor-autoform-bs-datetimepicker.git
$ cd meteor-autoform-bs-datetimepicker
$ git checkout v4beta

add line to ./meteor/packages

aldeed:autoform-bs-datetimepicker

Usage

  autoform:
    afFieldInput:
      type: "bootstrap-datetimepicker"
      buttonClasses: null # 'glyphicon glyphicon-calendar', 'fa fa-calendar'
      outMode: null # 'utcDate', 'utcDateTime'
      timezoneId: null # http://momentjs.com/timezone/
      dateTimePickerOptions: {}
      isReactiveValue: true

Using reactive variable to set date on timepicker, but date doesn't show.

I have a full calendar plugin, and I set the doc attribute of the quickForm template as the event I just clicked. The form sets the title and description, but not the start and end dates. It comes from the helper as "invalid date", but it is a valid date in the event variable, coming from the calendar plugin.

Value will be reset after validation problem

I am using this plugin for a date field.

When I submit the form and a validation error is there the value in the date field will automaticly reset to an empty value - so every time the form gets validated and there is any problem the datefield (even when the datefield isnt the problem) value gets reset to emtpy.

Datetime not reset on submit

When I submit a form, the form gets reset and the datetime input looks like it's reset (it's blank in the input in the form), but if I retry submit the form without the datetime filled in, it will use the previous value for this input.
What should really happen is an error, because the field is set as required, but because it remembers the previous value, there's no error, it just submits.

timezoneId doesn't work

Hi!

I'm using aldeed:moment-timezone and trying to set timezoneId up on my schema, as bellow:

afFieldInput: {
      type: 'bootstrap-datetimepicker',
      timezoneId: 'America/Sao_Paulo',
    },

But my datetime-picker locale doesn't change.

Type:Number is not working

Hi,

After trying changed type to number on a schema field as this:

checkpoint_time_epoch: {
type: Number,
autoform: {
afFieldInput: {
type: "bootstrap-datetimepicker"
}
},
label: "checkpoint_time_epoch"
}

The form submission stop working. I want to store the epoch on that field.

What am I doing wrong?
Joao

datepicker set date dynamic value

Hi @aldeed,

I'm having a hard time pulling this off, I have two datepicker, effectivityDate and maturityDate.

The value of maturity date is based on the sum of a duration productRange and effectivityDate.

here's my change event:

'change input[name=effectivityDate]': function ( event, template ) {
    var effectivity = $( event.target ).val();
    var range = ( $( 'select[name=productRange]' ).val() );
    var duration = moment.duration( parseInt( range, 10 ), 'months' );
    var value = moment( effectivity ).add( duration ).format( 'MM-DD-YYYY' );
    template.$( 'input[name=maturityDate]' ).val( value );
  },

The above change event is working as expected, during creation of document, the value of maturityDate is successfully saved on db even if i didn't pick a date on the picker, however, if I update the document, let say, i pick a later effectivityDate the value maturityDate is working as expected, but when I click the submit button the value of maturityDate is not updated, I noticed that even if the value of maturityDate after I pick effectivityDate is correct, the date on the actual picker is the current value on the db, see image below:

maturitydate

notice the value of maturityDate it's 08-18-2016 but on the picker it's 08-16-2016 which is the current value on the db.

Here's my schema for maturityDate:

maturityDate: {
    type: Date,
    label: "Maturity Date",
    optional: true,
    autoform: {
      type: "bootstrap-datepicker",
      datePickerOptions: {
        format: 'mm-dd-yyyy',
        forceParse: false,
        useCurrent: false
      },
      afFormGroup: {
        'formgroup-class': 'col-xs-4 col-sm-4 col-lg-1'
      }
    }
  },

Is there an option to tell the picker to set the date based on the computation without selecting a date?

Error: If you specify a timezoneId, make sure that you've added a moment-timezone package to your app

I'm getting the following error, even though I have mrt:moment-timezone in my packages file:

Exception in template helper: Error: If you specify a timezoneId, make sure that you've added a moment-timezone package to your app
    at Object.dateToNormalizedLocalDateAndTimeString (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:483:15)
    at Object.AutoForm.addInputType.valueIn (http://localhost:3000/packages/aldeed_autoform-bs-datetimepicker.js?279246d1cf7d4b5603ac030d7466e9bc6e5ac0d1:79:40)
    at getInputValue (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:1881:22)
    at Object.afFieldInputContext (http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:6028:17)
    at bindDataContext (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2727:16)
    at Blaze._wrapCatchingExceptions (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1606:16)
    at Spacebars.call (http://localhost:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:171:18)
    at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:108:25)
    at Object.Spacebars.dataMustache (http://localhost:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:140:39)
    at http://localhost:3000/packages/aldeed_autoform.js?b2b90d28d5cc29be68358bb3c8bb8a337992a7dd:5922:24

This is the collection: https://github.com/obvio171/rideboard/blob/master/lib/collections/rides.js

And this is the template: https://github.com/obvio171/rideboard/blob/master/client/rides/templates/rides_list.html

This error only happens when editing, not when inserting.

Any ideas on how to fix this? Thanks!

getDate() in undefined

Please change condition valueOut = this.data("DateTimePicker").getDate() to valueOut = this.data("DateTimePicker") && this.data("DateTimepicker").getDate()

Cannot read property 'destroy' of undefined in 172:41

When using the datetimepicker in a dynamic template i get "Cannot read property 'destroy' of undefined" when i leave a dynamic template by clicking on a different tab. When i enter the tab with the datetimepicker again i get "Cannot read property 'setDate' of undefined".

The error only exists with the datetimepicker. Not with the datepicker.

{{> DynamicTemplate template=getTemplate}}
getTemplate: function () {

    if(Session.get('selectedPanel') === 1){
      return "firstPanel";
    };

    if(Session.get('selectedPanel') === 2){
      return "QaPanel";
    };

 ...


  firstPanelActive:function(){
    if(Session.get('selectedPanel') === 1){
      return "active panel-tab";
    }else{
      return "panel-tab";
    }
  },

  QaPanelActive:function(){
    if(Session.get('selectedPanel') === 2){
      return "active panel-tab";
    }else{
      return "panel-tab";
    }
  },
...

problem with default value?

I would like to set default value on date picker:

// Schema
    datepicker: {
        type: Date,
        optional: true,
        autoform: {
            afFieldInput: {
                type: "bootstrap-datetimepicker",
                dateTimePickerOptions: {
                    pickTime: false
                }
            }
        }
    }

// Form
{{> afQuickField name='datepicker' value="01/15/2015"}}

UTC Time

Is there any way to bypass timezone detection, and take input as UTC time?

customizing

I'ts simple to customize look of picker using aldeed:template-extension like in readme but how to add event to open picker when clicked on calendar icon?

Blaze + Material.js + datetimepicker = craziness

I am not sure which repository to post this issue so I am starting here. I have a project using

When only picking a "day" on hover Blaze goes into an endless loop re-rendering the table elements. This happens about 80% of the time. Sometimes you need to click a date first to trigger the endless loop. It only happens when hovering over a day <td> element.

Removing Material.js from fezvrasta:bootstrap-material-design stops the bug.

My question is, why does this only happen on the day <td> element and not on any of the other datetime picker elements?

Wrong moment-timezone package

If you install mrt:moment-timezone package, it will throw an error.
Use risul:moment-timezone instead, it has proper dependencies!

Show debug on browser console "dtp.setDate is not a function"?

show

Exception from Tracker afterFlush function:
debug.js:41 TypeError: dtp.setDate is not a function
    at null.<anonymous> (aldeed_autoform-bs-datetimepicker.js:141)
    at blaze.js:1844
    at Function.Template._withTemplateInstanceFunc (blaze.js:3643)
    at blaze.js:1842

gooseman implementation throws an Error: datetimepicker component should be placed within a relative positioned container

Hello,

gooseman fork throws an Error: datetimepicker component should be placed within a relative positioned container.

I am using quickform with following schema:

"date": {
type: Date,
autoform: {
type: "bootstrap-datetimepicker",
dateTimePickerOptions: {
format: "DD.MM.YYYY",
showTodayButton: true,
showClear: true,
showClose: true
}
}
}

Dynamically added div contains only script="display: block;".

Any advices?

Incorrect place of popup when the datetimepicker place on the bottom of the screen.

I have multiple text box on my form, and the datetimepicker is on the bottom of the form (bottom of screen).
So when i focus on this, it show the popup date on the top of form/screen that so far with datetimepicker of text box (I think that, it don't have free space for display because it is nearly of bottom of screen).
How to solve this???

Incompatibility with tsega:bootstrap3-datetimepicker@4 and above

Some resources called in the most recent code of autoform-bs-datetimepicker are deprecated in relation to the newer versions of tsega:bootstrap3-datetimepicker and momentjs:moment (my error in particular says that setDate and getDate are not functions, for example). Is anyone working on this fix?

Error with 2 datetime fields in 1 form

When I have 2 or more datetime fields in the same form, I get the following error:

Exception from Tracker afterFlush function: Cannot read property 'getDate' of undefined TypeError: Cannot read property 'getDate' of undefined at AutoForm.addInputType.valueOut (http://localhost:3000/client/lib/autoform/datetimepicker.js?6fa47ef1e66e00501f0dffd331630b69ad89e540:19:40)

It's probably an easy fix, but I'm pretty new to the package.
Any suggestions?
Thanks!

Reset issue while adding new datetime field in a form.

Below is my Schema

  Players = new Meteor.Collection('players');
  MatchSchema = new SimpleSchema({
    title: {
      max: 50,
      type: String
    },
    start: {
      type: Date,
      autoform: {
        afFieldInput: {
          type: "bootstrap-datetimepicker"
        }
      },
      label: "Start date"
    }
  });

  PlayerSchema = new SimpleSchema({
    name: {
      max: 50,
      type: String
    },
    match: {
      type: [MatchSchema],
      min: 1
    }
  });

  Players.attachSchema(PlayerSchema);

I have created example app here. When user try to add a new date the previous selected date is getting reset.

interval settings on timepicker don't work with v. 3.1.3_3 of tsega:bootstrap3-datetimepicker

Any chance you can enable compatibility with the latest version of tsega:bootstrap3-datetimepicker? When I use version 3.1.3_3, the values I set for the "stepping" option have absolutely no effect; but the timepicker has the desired intervals when I install version 4.14.30_4. Problem is, with that version, a lot of meteor-autoform-bs-datetimepicker stops working correctly.

Exception from Tracker afterFlush function: undefined is not a function

Hello Eric! Everything was working fine until I updated to AutoForm 5.0 today. I get this when using this component (the bootstrap-datetimepicker):

Exception from Tracker afterFlush function: undefined is not a function

Steps to reproduce:

  1. A schema like this:
Schemas.someDate = new SimpleSchema({
  start: {
    type: Date
  }
});
  1. In the template I use:
{{#autoForm schema=Schemas.someDate id="loginForm"}}
{{> afFieldInput name='start' type="bootstrap-datetimepicker" }}
{{/autoForm}}
  1. Full stacktrace below:
Exception from Tracker afterFlush function: undefined is not a function
TypeError: undefined is not a function
    at null.<anonymous> (http://localhost:3000/packages/aldeed_autoform-bs-datetimepicker.js?279246d1cf7d4b5603ac030d7466e9bc6e5ac0d1:171:11)
    at http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1808:16
    at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2043:12)
    at viewAutorun (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1807:18)
    at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:296:36)
    at new Tracker.Computation (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:214:10)
    at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:487:11)
    at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1806:19)
    at Blaze.TemplateInstance.autorun (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:3116:20)
    at Template.afBootstrapDateTimePicker.rendered (http://localhost:3000/packages/aldeed_autoform-bs-datetimepicker.js?279246d1cf7d4b5603ac030d7466e9bc6e5ac0d1:163:8)

Any ideas?

When bootstrap navbar present, date picker appears above and off the screen.

If my main html page has a navbar on it as follows:

<body>
  <div class="container">
    <header>
      <div class="navbar navbar-inverse" role="navigation">
  ~ ~ ~

The navbar will not drop down below the box, it will go off the screen at the top, if your date time picker is close enough to the top of the screen.

I imagine this is due to some of the styling on the main body of the html that bootstrap3 puts on there. And it's probably fixable by going into the CSS and overriding some styling on this form - however as this is a bootstrap package, you'd think it would be compatible with other bootstrap elements on the page...

I haven't worked with css in a while, any ideas what would be causing this?

datepicker template

<template name="workout">
  <div class="container">
    {{#unless currentUser}}
    <div class="alert alert-warning well-lg">
      <span class="glyphicon glyphicon-flash" aria-hidden="true"></span> Please log in.
    </div>

    {{else}}
      {{> insertWorkoutForm}}
    {{/unless}}<!--currentUser -->
  </div>
</template>

<template name="insertWorkoutForm">
  <div class="container">
    {{#autoForm collection="Workouts" id="insertWorkoutForm" type="insert"}}
    <fieldset>
      <legend>Add a Workout</legend>
      {{> afQuickField name="date" type="bootstrap-datepicker" buttonClasses="glyphicon glyphicon-calendar"}} {{> afQuickField name='minutes'}}
    </fieldset>
    <button type="submit" class="btn btn-primary">Insert</button>
    {{/autoForm}}
  </div>
</template>

When using autosave, infinite loops happen

I dug into the code a bit, and the problem seems to be due to the call to setDate(...) here.

Unlike regular html inputs, bs-datetimepicker fires a change event whenever javascript code sets its value, so calling setDate() always causes a change event to fire, which
causes a form.submit() in meteor-autoform, which causes a write to minimongo, which invalidates the autorun(...) that our setDate(...) is inside of, and we spin around doing this all day =).

This appears to also be an issue in https://github.com/aldeed/meteor-autoform-bs-datepicker. Should I create a separate issue over there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.