Skip to content

Commit

Permalink
Try with Flatpickr
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Jun 3, 2022
1 parent 522f0fd commit d24c63d
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 116 deletions.
4 changes: 2 additions & 2 deletions assets/js/controllers/datepicker_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { Controller } from '@hotwired/stimulus';
import { TempusDominus } from '@eonasdan/tempus-dominus';
import Flatpickr from 'flatpickr';

export default class extends Controller {
static values = {
Expand All @@ -20,7 +20,7 @@ export default class extends Controller {

this.dispatchEvent('datepicker:pre-connect', { options });

const datePicker = new TempusDominus(this.element, options);
const datePicker = new Flatpickr(this.element, { ...options, wrap: true });

this.dispatchEvent('datepicker:connect', { datePicker });
}
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* file that was distributed with this source code.
*/

@import '@eonasdan/tempus-dominus';
@import 'flatpickr';
47 changes: 12 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dependencies": {
"@eonasdan/tempus-dominus": "6.0.0-beta7",
"@hotwired/stimulus": "3.0.1",
"@symfony/stimulus-bridge": "3.1.0",
"@hotwired/stimulus": "3.0.1"
"flatpickr": "4.6.13"
},
"devDependencies": {
"@babel/core": "^7.17",
Expand Down
1 change: 0 additions & 1 deletion src/Bridge/Symfony/Resources/public/430.js

This file was deleted.

1 change: 1 addition & 0 deletions src/Bridge/Symfony/Resources/public/527.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Resources/public/696.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Resources/public/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Resources/public/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Resources/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"bundles/sonataform/app.css": "/bundles/sonataform/app.css",
"bundles/sonataform/app.js": "/bundles/sonataform/app.js",
"bundles/sonataform/696.js": "/bundles/sonataform/696.js",
"bundles/sonataform/430.js": "/bundles/sonataform/430.js"
"bundles/sonataform/527.js": "/bundles/sonataform/527.js"
}
8 changes: 4 additions & 4 deletions src/Bridge/Symfony/Resources/views/Form/datepicker.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ file that was distributed with this source code.
class="input-group date"
id="dp_{{ id }}"
data-controller="datepicker"
data-datepicker-options-value="{{ dp_options|json_encode|escape('html_attr') }}"
data-datepicker-options-value="{{ datepicker_options|json_encode|escape('html_attr') }}"
>
{% endif %}
{% set attr = attr|merge({'data-date-format': moment_format}) %}
Expand All @@ -41,17 +41,17 @@ file that was distributed with this source code.
{% if datepicker_use_button %}
<div
class="input-group date
{#% if not dp_options['pickDate'] %}timepicker{% endif %#}"
{#% if not datepicker_options['pickDate'] %}timepicker{% endif %#}"
id="dtp_{{ id }}"
data-controller="datepicker"
data-datepicker-options-value="{{ dp_options|json_encode|escape('html_attr') }}"
data-datepicker-options-value="{{ datepicker_options|json_encode|escape('html_attr') }}"
>
{% endif %}
{% set attr = attr|merge({'data-date-format': moment_format}) %}
{{ block('datetime_widget') }}
{% if datepicker_use_button %}
<span class="input-group-addon">
<span class="fas {#% if dp_options['pickDate'] %}fa-calendar{% else %}fa-clock{% endif %#}fa-calendar"></span>
<span class="fas {#% if datepicker_options['pickDate'] %}fa-calendar{% else %}fa-clock{% endif %#}fa-calendar"></span>
</span>
</div>
{% endif %}
Expand Down
Loading

0 comments on commit d24c63d

Please sign in to comment.