-
-
Save richardprice/36ff986f79cc4aeecfc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="input-group date"> | |
<input type="text" value.bind="value" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {inject, customElement, bindable} from 'aurelia-framework'; | |
import moment from 'moment'; | |
import {datepicker} from 'eonasdan/bootstrap-datetimepicker'; | |
import 'eonasdan/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css!'; | |
@inject(Element) | |
@bindable("value") | |
export class DatePicker { | |
@bindable format = "DD/MM/YY"; | |
constructor(element) { | |
this.element = element; | |
} | |
attached() { | |
this.datePicker = $(this.element).find('.input-group.date') | |
.datetimepicker({ | |
format: this.format, | |
showClose: true, | |
showTodayButton: true | |
}); | |
this.datePicker.on("dp.change", (e) => { | |
this.value = moment(e.date).format(this.format); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment