Giter VIP home page Giter VIP logo

bootstrap4-datetime-picker-rails's Introduction

bootstrap4 datetime picker rails

Makes Tempus Dominus available to your rails appliation through the asset pipeline.

Usage Instructions

Add the following to your Gemfile and then run bundle

gem 'bootstrap4-datetime-picker-rails'

Add the following to application.js

//= require moment
// If you require timezone data (see moment-timezone-rails for additional file options)
//= require moment-timezone-with-data
//= require tempusdominus-bootstrap-4

Add the following to application.scss

@import "tempusdominus-bootstrap-4";

Or

*= require tempusdominus-bootstrap-4

If you are not using Sass, add the following to your application.css

/*
...
*= require tempusdominus-bootstrap-4
...
*/

Localizations

The Tempus Dominus datepicker exposes Moment.js localizations. A list of available Moment localizations are found here.

Select which JavaScript file you want to use and then add the following line in application.js

//= require moment/<locale>.js

Then, where your datepicker is configured (such as a .coffee file), add the following configuration option:

$(#datetimepicker).datetimepicker
  locale: 'de'

Update Instructions

Change the checkout_branch variable in Rakefile to the version.

Change the versions in lib/bootstrap4_datetime_picker_rails/version.rb

Run bundle exec rake update

Commit with 'Update to $VERSION release'

Run git push

Run bundle exec rake build to confirm a successful build

Run bundle exec rake publish to publish to rubygems (automatically creates and pushes a tag to git)

Create a release on GitHub with the new gem version

bootstrap4-datetime-picker-rails's People

Contributors

andresilveirah avatar bencolon avatar bialogs avatar buenaventure avatar dgilperez avatar eikes avatar excid3 avatar koukou73gr avatar limcross avatar madmax avatar nerian avatar raeno avatar ressu avatar rmm5t avatar robheittman avatar ruhmen avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

bootstrap4-datetime-picker-rails's Issues

Installation instructions

This gem didn't work for me until I added //= require moment to the application.js file since Momentjs-rails gem is a dependency. I strongly recommend including this in the Readme. Would have saved me quite some time.

Issue on using moment type

On creating option for min/maxDate

Default: false
Accepts: date, moment, string

This is my code:

const DATE_PICKER_OPTIONS = {
    useCurrent: true,
    format: 'Do MMM',
    minDate: moment()
};

function initDatePicker() {
    $('.datetimepicker-input').datetimepicker(DATE_PICKER_OPTIONS);
}

But I have a weird effect is that when click in the input, the date picker not open.
Only after I click again, the date picker show up.
Same problem when I'm using moment([]) or moment({});

Can't get defaultDate value to appear in field on page load

My text_field_tag has a value set that I can see in the HTML:
<input type="text" name="from" id="datepicker_from" value="2008-01-01" class="form-control datetimepicker-input" data-toggle="datetimepicker" data-target="#datepicker_from">

I expected this to be visible in the text field on page load. It wasn't.

So I set the defaultDate option to match and I can see it's set when I call: $('#datepicker_from').datetimepicker('defaultDate')

Yet my text field is still blank on page load.

If I click on the field, this date is pre-selected and if I click on the date, the field fills as expected. But it's not there on page load, like it is for the "Enabled/Disabled Dates" usage example in the usage docs.

Any ideas what I'm doing wrong?

Clock icon missing

The calendar icons shows up but the clock icon is not displaying...

I am using rails 5.2.3 and font-awesome 5.11.1

I am also using the font-awesome-sass gem.

Not working with Rails 5.2.1

I installed everything as you described, but I can't get it to work with rails 5.2, when I click on the input field nothing happens.
application.scss
@import "bootstrap"; @import "tempusdominus-bootstrap-4";
application.js
//= require rails-ujs //= require activestorage //= require jquery3 //= require turbolinks //= require popper //= require tempusdominus-bootstrap-4.js //= require moment //= require bootstrap //= require_tree .
simple html

<in put class="datepicker" type="text" > I mispelled input otherwise github would render it as html

and coffee script
$(document).on "turbolinks:load", -> \n console.log("prova") \n $('.datepicker').datetimepicker(); I also added the newline simply for an easier understanding
If i try the gem 'bootstrap-datepicker-rails' works perfectly but this one(I need also the time) is not working

Add mementjs dependency

I got error by adding following to application.js

//= require moment
//= require tempusdominus-bootstrap-4.js

Error: couldn't find file 'moment' with type 'application/javascript'

I got this error because I don't have momentjs installed. Fixed once I install momentjs myself.

I think it's good to add a cached momentjs file into this gem or add momentjs-rails dependency. I personal prefer adding a cached version.

Or at least we can add some instruction into README to remind users to install momentjs themselves.

How do you think?

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.