question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

timepicker: allow two-way binding to something else

See original GitHub issue

Users of timepicker (and, later, datepicker) will amost certainly want to bind the component to a string, a moment, a Date, or some other class that provides more functionality than a simple object with three fields.

I don’t know if the component should provide this functionality (for example by passing a TimeFormat input which would be responsible for transforming the {hour, minute, second} object to something else and vice-versa), or if this should be done outside of the component. If the latter, a demo demonstrating how to do that would be helpful.

There might be two different needs BTW: creating a new string every time the model changes, and mutating the time part of a moment/Date.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
pkozlowski-opensourcecommented, Aug 5, 2016

But I’m on master, which uses the new forms module (imports are from ‘@angular/forms’), whereas your plunkr uses the deprecated forms (imports are from ‘@angular/common’). I suspect this is where the problem comes from.

This is very probable! Let’s wait for RC5 with the new forms to land and then re-test.

1reaction
bedag-moocommented, Oct 26, 2017

Another possible design is to dependency inject a global service, like you do with the NgbDateParserFormatter (generally, an API will use the same date representation throughout, so configuring this at the application level will usually be enough).

It’s also worth noting that angular/angular#11097 only affects object representations. I happen to only need ISO 8601 strings 😃

This issue is not urgent for me though, because I wrap the NgbInputDatePicker anyway, and have now decorated its ControlValueAccessor and Validator to convert to ISO 8601 and back 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Different behavior when Binding TimePicker and ...
I could reproduce this issue, it looks x:Bind TwoWay model make the binding circular, I can sure it is not by design.
Read more >
Implementing Custom Date and Time Picker with 2-way Data ...
This blog explains how we implemented our own custom Date and Time picker with 2-way data binding support using the Data binding framework....
Read more >
Xamarin.Forms TimePicker - Microsoft Learn
The Time property has a default binding mode of BindingMode. TwoWay , which means that it can be a target of a data...
Read more >
How to Two-way binding in Angular TimePicker component
The following example demonstrates how to achieve two-way binding by binding the value to the first TimePicker component by using property binding and ......
Read more >
Two-way data binding - Android Developers
Annotate the method that sets the initial value and updates when the value changes using @BindingAdapter : Kotlin Java More. @BindingAdapter(" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found