Bolero datetime bind

49 views Asked by At

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?

1

There are 1 answers

0
Callum Linington On BEST ANSWER

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