Comments (4)
It seems may be like this
<?= $form->field($model, 'done_till')->widget(DatePicker::className(),
[
'inline' => true,
'template' => '<div class="well" style="background-color: #fff; width:250px">{input}</div>',
'language' => 'ru',
'clientOptions' => [
'autoclose' => true,
'format' => new JsExpression('{
toDisplay: function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() - 7);
return d.toISOString();
},
toValue: function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() + 7);
return new Date(d);
}
}'),
]
]
);?>
or like this
<?= $form->field($model, 'done_till')->widget(DatePicker::className(),
[
'inline' => true,
'template' => '<div class="well" style="background-color: #fff; width:250px">{input}</div>',
'language' => 'ru',
'clientOptions' => [
'autoclose' => true,
'format' => [
'toDisplay' => new JsExpression('function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() - 7);
return d.toISOString();
}'),
'toValue' => new JsExpression('function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() + 7);
return new Date(d);
}')
]
]
]
);?>
But it doesn't work.
Any ideas?
from yii2-date-picker-widget.
@tonydspaniard sure
jQuery(document).ready(function () {
;jQuery('#task-deadline').parent().datepicker({"autoclose":true,"format":"dd.mm.yyyy","class":"col-md-3","language":"ru"});
;jQuery('#task-done_till').parent().datepicker({"autoclose":true,"format":{
toDisplay: function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() - 7);
return d.toISOString();
},
toValue: function (date, format, language) {
var d = new Date(date);
d.setDate(d.getDate() + 7);
return new Date(d);
}
},"language":"ru"});
;jQuery('#task-done_till').parent().on('changeDate', function (e){ jQuery('#task-done_till').val(e.format());});
jQuery('#w0').yiiActiveForm([{"id":"task-sum","name":"sum","container":".field-task-sum","input":"#task-sum","error":".help-block.help-block-error","validate":function (attribute, value, messages, deferred, $form) {yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"Значение «Сумма» должно быть целым числом.","skipOnEmpty":1});}}], []);
});
from yii2-date-picker-widget.
@re8us what is the response on your browser? can we have a look at the javascript code rendered?
from yii2-date-picker-widget.
Thanks! checking
from yii2-date-picker-widget.
Related Issues (20)
- Make property DateRangePicker::_template protected instead private HOT 3
- Using as a time picker only has broken date header HOT 1
- Dependant Datepickers HOT 1
- Bootstrap-datepicker trigger 'show.bs.modal' when it is displayed HOT 2
- The missing file: 'js/bootstrap-datepicker.js'. HOT 3
- Calendar does not pop up HOT 5
- datepicker.css not found HOT 4
- Date 'format' is not respected on 'Update'. HOT 1
- If the date is 0000-00-00 HOT 1
- using daterangepicker in gridview documentation not given HOT 1
- Localize
- Clear button problem HOT 3
- Is not installing properly, why? HOT 2
- I recently discovered that using the plug-in bootstrap drop-down menu can't be used. What should I do HOT 8
- Selected date does not set in form
- 0000-00-00 00:00:00 value on save HOT 3
- dateFormat yyyy-M-dd does not work well when I set the language to zh-CN
- No work in modal HOT 1
- The file or directory to be published does not exist: vendor/bower/bootstrap-datepicker/dist HOT 1
- Extra Asset included in DatePickerLanguageAsset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-date-picker-widget.