简体   繁体   中英

Bolero datetime bind

The docs say that you can bind many different data types...

My html template:

  <div class="field">
    <label class="label">Dob</label>
    <div class="control">
      <input class="input" type="date" placeholder="Date of Birth..." bind="${Dob}">
    </div>
  </div>

And my code is:

  .Dob(model.client.dob, fun n -> dispatch (SetDob n))

But I get a red underline on model.client.dob because it's expecting a string.... what is the correct way of doing this?

Assuming it's probably something like this?

        .Dob(
            model.client.dob.ToString("yyyy-MM-dd"), 
            fun n -> 
                let dt = DateTimeOffset.Parse(n)
                dispatch (SetDob dt)
        )

I would have thought that was built in... from how the docs talk about

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM