Giter VIP home page Giter VIP logo

Comments (6)

binbalenci avatar binbalenci commented on September 23, 2024

I double this as well. Having a confirm button but as picking date already updating it is just pure chaotic.

from datetime-picker.

fooloomanzoo avatar fooloomanzoo commented on September 23, 2024

@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.

chisholmd avatar chisholmd commented on September 23, 2024

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.

chisholmd avatar chisholmd commented on September 23, 2024

Sry I should have used mark down better

from datetime-picker.

fooloomanzoo avatar fooloomanzoo commented on September 23, 2024

@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.

chisholmd avatar chisholmd commented on September 23, 2024

Coolness :)

from datetime-picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.