ghiscoding / Aurelia-Bootstrap-Plugins

Aurelia-Bootstrap-Plugins are Custom Elements to bridge with a set of 3rd party Bootstrap addons
https://ghiscoding.github.io/Aurelia-Bootstrap-Plugins
MIT License
45 stars 23 forks source link

value.bind for datetimepicker #29

Closed robscottnh closed 7 years ago

robscottnh commented 7 years ago

This is very likely to be my problem as I'm new to using aurelia and this plugin, but the initial display of the date doesn't seem to bind to the value in my viewModel.

// counter.html ` `

// counter.ts export class Counter {
public date:Date;

public incrementCounter()
{
  this.date = new Date(1960, 3, 10);
}

}

// boot.ts aurelia.use.plugin(PLATFORM.moduleName("aurelia-bootstrap-datetimepicker"));

// package.json "aurelia-bootstrap-datetimepicker": "^1.0.11",

Like I said above, it's probably something fundamental that I'm doing wrong... but what I see is that the date does not show up in the text box when the page displays, and then when clicking in the textbox (and causing the calendar to display), the date is not set in the calendar either (probably since it never showed in the textbox initially). If I do pick a date in the calendar once it displays, or if I enter a date manually, the data will then show correctly if i re-enter the control.

Regards and thanks for your time, Rob

ghiscoding commented 7 years ago

You should look at the client samples, that might help you. Indeed I don't think it's on the plugin side but maybe somewhere in your code. Please take a look at client-wp (WebPack) for example, and maybe try to build/run it to get you going.

ghiscoding commented 7 years ago

Another quick look at your View, you are not passing the options in the correct way. You CANNOT pass format="", you need to use options.bind={ format: '..' }"

Please read the README for full instructions

robscottnh commented 7 years ago

Thanks for the link to the client webpack example, I suspect that will do the trick. Not sure how I deleted the options.bind, I had it in there at one point,... I suspect I was trying somethings and forgot to restore it properly. If you don't mind leaving this open, it'll be the first thing I look at tomorrow and I'll close it myself if I figure it out. As I said, I suspect it's my issue and not the plugin.

Thanks for the timely response, Rob

p.s. if you need to close it, it's fine.

ghiscoding commented 7 years ago

You can close it once you get it resolved. If you like it, you could also up vote ⭐️ Cheers

P.S. The client are there for references and I use them for testing the plugins and for everyone to try them out. Maybe some day I will find out how to create a website with Github.io to show them in action, but in the mean time, the client samples will do.

robscottnh commented 7 years ago

I was able to get it working. It turns out the issue was the format of the date that was being bound. The server side had changed to returning UTC and I needed to convert to local time.

Thanks for the great support! Also the examples were excellent for looking at configuration options. Kudos.