Hi all,
i need the datepicker of boostrap(http://bootstrap-datepicker.readthedocs.io/en/latest/ )
How can i take the value of the date?!
<div class="form-group">
<div class="col-sm-2">
<label class="control-label">Entro Data 2</label>
</div>
<div class="col-sm-10">
<div class="input-group">
<div class="input-group-addon">
<img width="15" height="15" src="../../assets/images/icon_esclamation.png" />
</div>
<input class="form-control" id="date" value.bind="dateEntered" model.bind="dateObject" name="date" placeholder="MM/DD/YYY" type="text" />
</div>
</div>
</div>
ādateEnteredā and ādateObjectā are undefined always.
I noticed there is an aurelia port of this plugin
https://www.npmjs.com/package/aurelia-bootstrap-datepicker
Perhaps you can find your answer within that code. Good luck!
2 Likes
Sorry man, but it gives to me this errorā¦
I see always this error with all package that i install by NPMā¦ infact my solution is to download the source of the package and ālinkā the ādist/jsā and ādist/cssā that i needā¦ any solution?
Thank you,
Andrea
you can get the value of the date from the āchangeDateā event:
attached() {
this.picker = $('#date').datepicker();
this.picker.on('changeDate', e => {
this.dateEntered = e.date;
});
}
arabsight:
$
For me $ doesnāt work i donāt know but i tryied all methods that i found in intenet hahaha but iām not able to take the elements from the DOM.
iām using typescript on Asp.Net Core.
you need to import jquery, something like : import * as $ from 'jquery'
First install jquery and add in aurelia.json, then install bootstrap datepicker and also add in aurelia.json
"jquery",
{
"name": "bootstrap-datepicker",
"path": "../node_modules/bootstrap-datepicker/dist",
"main": "js/bootstrap-datepicker",
"deps": [ "jquery" ]
}
Then you can use it in creating custom element or in the view
import * as $ from 'jquery';
import 'bootstrap-datepicker';
but i donāt have aurelia.json ā¦
I have the value, but i want to set the āminDateā of other datepicker to create a datepicker range.
Iām not able to āupdateā the graphics of the controlā¦ any suggestion?
If you canāt use dollar sign, you might be having trouble with exports of your libraries. Take a look at how I setup bootstrap (which re-exports doillar sign from jquery) and lodash from my aurelia.json. I use requireJS so I canāt speak to any WebPack-iness.
{
"name": "bootstrap",
"path": "../node_modules/bootstrap/dist",
"main": "js/bootstrap.min.js",
"deps": [
"jquery",
"popper.js"
],
"exports": "$",
"resources": [
"css/bootstrap.css"
]
},
{
"name": "lodash",
"path": "../node_modules/lodash",
"main": "lodash.min",
"exports": "_"
}