Comments (6)
I double this as well. Having a confirm button but as picking date already updating it is just pure chaotic.
from datetime-picker.
@chisholmd @binhbbui411 A workaround could be to just search when the opened
-attribute is false
. But in the next version there will be a no-mediation
attribute, if you like no mediation (like now) and as default that behavior, you mean. But it will always be the date
, time
, datetime
or value
attribute that notify because of simplifying the element and keeping the same accessibility for the native picker. The other attributes may still change (year, month, day, ...).
from datetime-picker.
In datetime-mixin.html I added this:
confirmedDate: {
type: String,
reflectToAttribute: true,
notify: true
},
/**
* the selected time (format: iso8061)
*/
confirmedTime: {
type: String,
reflectToAttribute: true,
notify: true
},
Then in input-picker-pattern.html
static get _buttonTemplate() {
return ${super._buttonTemplate || ''} <svg class="icon button close" hidden$="[[!opened]]" viewBox="0 0 24 24" on-click="myclose"><g><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></g></svg> <svg class="icon button close" hidden$="[[!opened]]" viewBox="0 0 24 24" on-click="mycancel"><g><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></g></svg>
;
}
AND
myclose(e){
this.confirmedDate = this.date;
this.confirmedTime = this.time;
this.close(e);
}
mycancel(e){
this.date = this.confirmedDate
this.time = this.confirmedTime
this.close(e);
}
myclose(e){
this.confirmedDate = this.date;
this.confirmedTime = this.time;
this.close(e);
}
mycancel(e){
this.close(e);
}
That did the trick
The user can select a date and a time and click the checkmark to confirm or the x to cancel. I can choose to bind to confirmedDate and or just Date so the control can still do both.
from datetime-picker.
Sry I should have used mark down better
from datetime-picker.
@chisholmd In the newest version 2.4.2 I implemented both. To deactivate confirming
set auto-confirm-attribute, so that confirmed-datetime
, confirmed-date
and confirmed-time
are auto-confirmed, else they are handled in the way you expect it. Reason is that this behavior might not be wanted by everyone, but this way it is more a simular behavior to the native picker. There are also now separate inputs for datetime, date and time (without a picker and any confirmation). Regards!
from datetime-picker.
Coolness :)
from datetime-picker.
Related Issues (20)
- DatetimePolyfillPickerMixin is not set on the window object like other mixins. HOT 1
- Polymer 3.0 support? HOT 6
- Feature request: hide reset button HOT 1
- Quitting editing, or resetting field to null HOT 1
- Feature request: fire event on value reset HOT 2
- Clamp values incorrect in the documentation HOT 1
- calendar-element When confirm, it autoSubmit form HOT 3
- Calandar element submit my form automatically HOT 1
- Change width of overlay-datetime-picker HOT 1
- npm installation fails HOT 2
- i've got a widget I need HOT 1
- Typing values manually HOT 6
- onchange event (from lit-element) HOT 7
- Style input to fit Twitter Bootstrap HOT 1
- Dead links in readme.md
- ES6 with Polymer 2 HOT 1
- input-picker-closed Not Triggering Function
- date-picker Stops Navigating
- Not able to use with-timezone , errors if the timezone is active
- Disable double click feature
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 datetime-picker.