Skip to content

Commit 2a301ca

Browse files
committed
feat: add ValueOrNow property to LocalTimeForm for initial date and time setting
1 parent f548d6d commit 2a301ca

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

example/BlazorLocalTimeSample/Pages/Home.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,12 @@
149149

150150
<p>
151151
If you want to use non-nullable components or create a form that sets the current date and time as the initial value,
152-
you can use the <code>DateOrToday</code> and <code>TimeOrNow</code> properties.
152+
you can use the <code>ValueOrNow</code>, <code>DateOrToday</code> and <code>TimeOrNow</code> properties.
153153
</p>
154154
<pre><code class="language-razor">Value: @@(Dt?.ToString("yyyy-MM-dd HH:mm:ssK") ?? "Not specified yet")
155155
&lt;br /&gt;
156156
&lt;LocalTimeForm @@bind-Value="Dt" Context="dtf"&gt;
157+
&lt;InputDate Type="InputDateType.DateTimeLocal" @@bind-Value="dtf.ValueOrNow" /&gt;
157158
&lt;InputDate Type="InputDateType.Date" @@bind-Value="dtf.DateOrToday" /&gt;
158159
&lt;InputDate Type="InputDateType.Time" @@bind-Value="dtf.TimeOrNow" /&gt;
159160
&lt;button @@onclick="() =&gt; Dt = null"&gt;Reset&lt;/button&gt;
@@ -168,6 +169,7 @@
168169
Value: @(Dt2?.ToString("yyyy-MM-dd HH:mm:ssK") ?? "Not specified yet")
169170
<br />
170171
<LocalTimeForm @bind-Value="Dt2" Context="dtf">
172+
<InputDate Type="InputDateType.DateTimeLocal" @bind-Value="dtf.ValueOrNow" />
171173
<InputDate Type="InputDateType.Date" @bind-Value="dtf.DateOrToday" />
172174
<InputDate Type="InputDateType.Time" @bind-Value="dtf.TimeOrNow" />
173175
<button @onclick="() => Dt2 = null">Reset</button>

0 commit comments

Comments
 (0)