question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to use altFormat with an input group?

See original GitHub issue

Hi again!

Sorry if it is in the docs, but I couldn’t find how to do it.

I have an input group and when I initialize the flatpickr instance with altInput and altFormat inside the options, the new input (the one with altFormat) appears completely unformatted, without classes or anything.

My code: HTML

<div
  class="input-group flatpickr"
  data-wrap="true"
>
  <div class="input-group-addon" data-toggle>
      <span class="fa fa-calendar"></span>
  </div>
  <input
    type="text"
    class="form-control"
    data-input
    data-open
  />
</div>

JS

flatpickr('.flatpickr' {
  dateFormat: 'Y-m-d',
  altInput: true,
  altFormat: 'd/m/Y',
  onChange: date => { ... },
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mathius17commented, Jun 23, 2016

Ohhh, that’s not in the docs. Thanks!

1reaction
chmlncommented, Jun 23, 2016

There is an altInputClass option that precisely targets the problem you’re having. See https://jsfiddle.net/chmln/uqt4qq1a/

Read more comments on GitHub >

github_iconTop Results From Across the Web

altFormat not working in jQuery datepicker input field
The altFormat option doesn't control the formatting of the input with the date picker, but the format of an alternate (usually hidden) field...
Read more >
Options - Flatpickr
Config Option Type Default altFormat String "F j, Y" altInput Boolean false altInputClass String ""
Read more >
jQuery UI Datepicker altFormat Option - GeeksforGeeks
In this article, we will see how to use the altFormat option in jQuery UI ... < p >Enter Date: < input type...
Read more >
flatpickr - lightweight datetimepicker & calendar - UNPKG
altInput can be used for displaying a friendly date format (per altFormat ) to the user while sending the date formatted as dateFormat...
Read more >
Datepicker Widget - jQuery UI API Documentation
An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found