Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

[WIP] Eonasdan datetimepicker update v4.7.14 #149

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Form/Type/BasePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@ public function finishView(FormView $view, FormInterface $form, array $options)
if (isset($options['date_format']) && is_string($options['date_format'])) {
$format = $options['date_format'];
} elseif (is_int($format)) {
$timeFormat = ($options['dp_pick_time']) ? DateTimeType::DEFAULT_TIME_FORMAT : \IntlDateFormatter::NONE;
$timeFormat = ($this->getName() == 'sonata_type_datetime_picker') ? DateTimeType::DEFAULT_TIME_FORMAT : \IntlDateFormatter::NONE;
$intlDateFormatter = new \IntlDateFormatter(\Locale::getDefault(), $format, $timeFormat, null, \IntlDateFormatter::GREGORIAN, null);
$format = $intlDateFormatter->getPattern();
}

// use seconds if it's allowe in format
$options['dp_use_seconds'] = strpos($format, 's') !== false;

$view->vars['moment_format'] = $this->formatConverter->convert($format);

$view->vars['type'] = 'text';
Expand Down Expand Up @@ -87,20 +84,23 @@ protected function getCommonDefaults()
return array(
'widget' => 'single_text',
'datepicker_use_button' => true,
'dp_pick_time' => true,
'dp_use_current' => true,
'dp_min_date' => '1/1/1900',
'dp_max_date' => null,
'dp_show_today' => true,
'dp_language' => \Locale::getDefault(), // 'en'
'dp_default_date' => '',
'dp_disabled_dates' => array(),
'dp_enabled_dates' => array(),
'dp_max_date' => false,
'dp_show_today_button' => true,
'dp_locale' => \Locale::getDefault(), // 'en'
'dp_default_date' => false,
'dp_disabled_dates' => false,
'dp_enabled_dates' => false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cannot remove the value, we need to be BC compatible. Just convert the values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean I have to keep using the option dp_show_today and convert it to dp_show_today_button ?

What about the removed options dp_use_minutes, dp_use_seconds and dp_pick_time ?

'dp_icons' => array(
'time' => 'glyphicon glyphicon-time',
'date' => 'glyphicon glyphicon-calendar',
'up' => 'glyphicon glyphicon-chevron-up',
'down' => 'glyphicon glyphicon-chevron-down',
'time' => 'glyphicon glyphicon-time',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like glyphicon was replaced by font-awesome

'date' => 'glyphicon glyphicon-calendar',
'up' => 'glyphicon glyphicon-chevron-up',
'down' => 'glyphicon glyphicon-chevron-down',
'previous' => 'glyphicon glyphicon-chevron-left',
'next' => 'glyphicon glyphicon-chevron-right',
'today' => 'glyphicon glyphicon-screenshot',
'clear' => 'glyphicon glyphicon-trash',
),
'dp_use_strict' => false,
'dp_side_by_side' => false,
Expand Down
1 change: 0 additions & 1 deletion Form/Type/DatePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class DatePickerType extends BasePickerType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array_merge($this->getCommonDefaults(), array(
'dp_pick_time' => false,
'format' => DateType::DEFAULT_FORMAT,
)));
}
Expand Down
4 changes: 1 addition & 3 deletions Form/Type/DateTimePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ class DateTimePickerType extends BasePickerType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array_merge($this->getCommonDefaults(), array(
'dp_use_minutes' => true,
'dp_use_seconds' => true,
'dp_minute_stepping' => 1,
'dp_stepping' => 1,
'format' => DateTimeType::DEFAULT_DATE_FORMAT,
'date_format' => null,
)));
Expand Down
11 changes: 6 additions & 5 deletions Resources/doc/reference/form_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ In your layout, you'll need to add the assets dependencies (feel free to adapt t
<head>
<!-- ... -->
<script type="text/javascript" src="path_to_jquery.min.js"></script>
<script type="text/javascript" src="/bundles/sonatacore/public/vendor/moment/min/moment.min.js"></script>
<script type="text/javascript" src="/bundles/sonatacore/vendor/moment/min/moment.min.js"></script>
<!-- Or if you want to use different moment locales -->
<!-- <script type="text/javascript" src="/bundles/sonatacore/vendor/moment/min/moment-with-locales.min.js"></script> -->
<script type="text/javascript" src="path_to_bootstrap.min.js"></script>
<script type="text/javascript" src="/bundles/sonatacore/public/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="path_to_bootstrap.min.css" />
<link rel="stylesheet" href="/bundles/sonatacore/public/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="/bundles/sonatacore/vendor/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />
</head>

Finally, in your form, you may use the form type as follows:
Expand All @@ -279,7 +281,7 @@ Finally, in your form, you may use the form type as follows:
// ...
;

Many of the `standard date picker options <http://eonasdan.github.io/bootstrap-datetimepicker/#options>`_ are available by adding options with a ``dp_`` prefix:
Many of the `standard date picker options <http://eonasdan.github.io/bootstrap-datetimepicker/Options/>`_ are available by adding options with a ``dp_`` prefix:


.. code-block:: php
Expand All @@ -291,7 +293,6 @@ Many of the `standard date picker options <http://eonasdan.github.io/bootstrap-d
->add('publicationDateStart', 'sonata_type_datetime_picker', array(
'dp_side_by_side' => true,
'dp_use_current' => false,
'dp_use_seconds' => false,
)) // Or sonata_type_date_picker if you don't need the time
// ...
;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "eonasdan-bootstrap-datetimepicker",
"version": "3.1.3",
"version": "4.0.0",
"main": [
"build/css/bootstrap-datetimepicker.min.css",
"build/js/bootstrap-datetimepicker.min.js"
"build/js/bootstrap-datetimepicker.min.js",
"src/less/_bootstrap-datetimepicker.less",
"src/less/bootstrap-datetimepicker-build.less",
"src/js/bootstrap-datetimepicker.js"
],
"dependencies": {
"jquery": ">=1.8.3",
"bootstrap": ">= 3.0",
"moment": ">=2.8.0"
},
"homepage": "https://github.com/Eonasdan/bootstrap-datetimepicker",
Expand All @@ -32,13 +34,13 @@
"test",
"tests"
],
"_release": "3.1.3",
"_release": "4.0.0",
"_resolution": {
"type": "version",
"tag": "v3.1.3",
"commit": "a597288db638f7c959e78d29ea53db7b6b2a9149"
"tag": "v4.0.0",
"commit": "557b657221c0059dca361cdac982001b25152e5e"
},
"_source": "git://github.com/Eonasdan/bootstrap-datetimepicker.git",
"_target": "3.1.3",
"_target": "4.0.0",
"_originalSource": "eonasdan-bootstrap-datetimepicker"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Submitting Issues
=================

If you are submitting a bug, please test and/or fork [this jsfiddle](http://jsfiddle.net/kmbo576p/) demonstrating the issue. Code issues and fringe case bugs that do not include a jsfiddle (or similar) will be closed.
If you are submitting a bug, please test and/or fork [this jsfiddle](http://jsfiddle.net/d3wCU/) demonstrating the issue. Code issues and fringe case bugs that do not include a jsfiddle (or similar) will be closed.

Contributing code
=================
Expand All @@ -20,7 +20,7 @@ grunt # this runs tests and jshint
Very important notes
====================

* **Pull requests to the `master` branch will be closed.** Please submit all pull requests to the `development` branch.
* **Pull pull requests to the `master` branch will be closed.** Please submit all pull requests to the `development` branch.
* **Do not include the minified files in your pull request.** Don't worry, we'll build them when we cut a release.

Grunt tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ module.exports = function (grunt) {

jshint: {
all: [
'Gruntfile.js', 'src/js/*.js'
'Gruntfile.js', 'src/js/*.js', 'test/*.js'
],
options: {
'browser' : true,
'node' : true,
'jquery' : true,
'boss' : false,
'curly' : true,
'debug' : false,
Expand Down Expand Up @@ -57,15 +58,24 @@ module.exports = function (grunt) {
'quotmark' : 'single',
'globals': {
'define': false,
'jQuery': false,
'moment': false
'moment': false,
// Jasmine
'jasmine': false,
'describe': false,
'xdescribe': false,
'expect': false,
'it': false,
'xit': false,
'spyOn': false,
'beforeEach': false,
'afterEach': false
}
}
},

jscs: {
all: [
'Gruntfile.js', 'src/js/*.js'
'Gruntfile.js', 'src/js/*.js', 'test/*.js'
],
options: {
config: '.jscs.json'
Expand All @@ -86,22 +96,49 @@ module.exports = function (grunt) {
'build/css/bootstrap-datetimepicker.css': 'src/less/bootstrap-datetimepicker-build.less'
}
}
},

jasmine: {
customTemplate: {
src: 'src/js/*.js',
options: {
specs: 'test/*Spec.js',
helpers: 'test/*Helper.js',
styles: [
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'build/css/bootstrap-datetimepicker.min.css'
],
vendor: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/moment/min/moment-with-locales.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js'
],
display: 'none',
summary: 'true'
}
}
}

});

grunt.loadTasks('tasks');

grunt.loadNpmTasks('grunt-contrib-jasmine');

// These plugins provide necessary tasks.
require('load-grunt-tasks')(grunt);

// Default task.
grunt.registerTask('default', ['jshint', 'jscs']);
grunt.registerTask('default', ['jshint', 'jscs', 'less', 'jasmine']);

// travis build task
grunt.registerTask('build:travis', [
// code style
'jshint', 'jscs'
'jshint', 'jscs',
// build
'uglify', 'less',
// tests
'jasmine'
]);

// Task to be run when building
Expand Down Expand Up @@ -131,7 +168,7 @@ module.exports = function (grunt) {
done();
});
}
else {
else { //--target=css
grunt.util.spawn({
cmd: 'src/nuget/nuget.exe',
args: [
Expand All @@ -152,4 +189,6 @@ module.exports = function (grunt) {
});
}
});

grunt.registerTask('test', ['jshint', 'jscs', 'uglify', 'less', 'jasmine']);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) {{{year}}} {{{fullname}}}
Copyright (c) 2015 Jonathan Peterson (@Eonasdan)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Bootstrap v3 datetimepicker widget ![GitHub version](https://badge.fury.io/gh/Eonasdan%2Fbootstrap-datetimepicker.png)&nbsp;&nbsp;&nbsp;![Travis](https://travis-ci.org/Eonasdan/bootstrap-datetimepicker.svg?branch=development)
# Bootstrap 3 Date/Time Picker
![GitHub version](https://badge.fury.io/gh/Eonasdan%2Fbootstrap-datetimepicker.png)&nbsp;&nbsp;&nbsp;![Travis](https://travis-ci.org/Eonasdan/bootstrap-datetimepicker.svg?branch=development)

![DateTimePicker](http://i.imgur.com/nfnvh5g.png)

## [View the manual and demos](http://eonasdan.github.io/bootstrap-datetimepicker/)

#v4
v4 is out now! For v4 related bugs and issues see: /Eonasdan/bootstrap-datetimepicker/labels/v4.

v3 is going into an archive state. Please be sure to check the documents. v4 has breaking changes and is a major rewrite.

## Submitting Issues
Please test and/or fork [this jsfiddle](http://jsfiddle.net/kmbo576p/) with an example of your issue before you post an issue here.
If you have issues, please check the following first:
* Have you read the docs?
* Do you have the latest version of momentjs?
* Do you have the latest version of jQuery?
* Please test and/or fork [this jsfiddle](http://jsfiddle.net/Eonasdan/0Ltv25o8/) with an example of your issue before you post an issue here.

## Where do you use this?
I'd love to know if your public site is using this plugin and list your logo on the documentation site. Please email me `eonasdan at outlook dot com`. Do not submit issue/feature request to this email, they will be ignored.

## [Installation instructions](https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Installation)
Installation instructions has been moved to the wiki

## [Change Log](https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Change-Log)
The change log has moved to the wiki
## [Change Log](https://github.com/Eonasdan/bootstrap-datetimepicker/wiki/Version-4-changelog)
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "eonasdan-bootstrap-datetimepicker",
"version": "3.1.3",
"version": "4.0.0",
"main": [
"build/css/bootstrap-datetimepicker.min.css",
"build/js/bootstrap-datetimepicker.min.js"
"build/js/bootstrap-datetimepicker.min.js",
"src/less/_bootstrap-datetimepicker.less",
"src/less/bootstrap-datetimepicker-build.less",
"src/js/bootstrap-datetimepicker.js"
],
"dependencies": {
"jquery": ">=1.8.3",
"bootstrap": ">= 3.0",
"moment": ">=2.8.0"
},
"homepage": "https://github.com/Eonasdan/bootstrap-datetimepicker",
Expand Down
Loading