The vaadin components doc has an example for vaadin-date-picker which links two date pickers.
I’ve tried to add the sample code to my dom-module, however the query selectors in the whenDefined method are returning null for #start and #end.
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/vaadin-date-picker/src/vaadin-date-picker.html">
<dom-module id="leave-settings">
<template>
<style include="shared-styles">
:host {
display: block;
height: 100%;
}
</style>
<div>
<vaadin-date-picker id="start" label="First Day" placeholder="Pick a date"></vaadin-date-picker>
<vaadin-date-picker id="end" label="Last Day" placeholder="Pick a date"></vaadin-date-picker>
</div>
</template>
<script>
class LeaveSettings extends Polymer.Element
{
static get is()
{
return 'leave-settings';
}
static get properties()
{
return {
// Declare your properties here.
};
}
}
customElements.define(LeaveSettings.is, LeaveSettings);
customElements.whenDefined('vaadin-date-picker').then(function()
{
debugger;
// these two calls return null.
var start = document.querySelector('#start');
var end = document.querySelector('#end');
start.addEventListener('change', function()
{
end.min = start.value;
// Open the second date picker when the user has selected a value
if (start.value)
{
end.open();
}
});
end.addEventListener('change', function()
{
start.max = end.value;
});
});
</script>
</dom-module>