File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
example/BlazorLocalTimeSample/Pages Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ Displays formatted local time text.
3636| ` Value ` | ` DateTimeOffset? ` | - | UTC datetime to display |
3737| ` Format ` | ` string ` | ` "yyyy-MM-dd HH:mm:ss" ` | Display format string |
3838| ` DisableTimeElement ` | ` bool ` | ` false ` | Whether to wrap in ` <time> ` element |
39+ | ` OnNullText ` | ` string? ` | ` null ` | Text to display if ` Value ` is null |
40+ | ` OnNullContent ` | ` RenderFragment? ` | ` null ` | Content to display if ` Value ` is null |
3941
4042### ` LocalTime `
4143Provides local time via render fragment with loading and error state support.
Original file line number Diff line number Diff line change 6969 <LocalTimeText Value =" @DateTime.UtcNow" Format =" yyyy-MM-dd HH:mm:ssK" />
7070</div >
7171
72+ <p >
73+ If you want to specify what to display when the value is null, you can use the <code >OnNullText</code > or <code >OnNullContent</code > parameters.
74+ </p >
75+
76+ <pre ><code class =" language-razor" >< ; LocalTimeText Value="@@null" DisableTimeElement OnNullText="No date available" /> ; </code ></pre >
77+
78+ <div class =" component-sample" >
79+ <LocalTimeText Value =" @null" DisableTimeElement OnNullText =" No date available" />
80+ </div >
81+
7282<p >
7383 Alternatively, you can use the <code >LocalTime</code > component to receive the converted value in the child content:
7484</p >
You can’t perform that action at this time.
0 commit comments