Skip to content

Commit

Permalink
fix: error clearing datetime time component (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewingjm authored Dec 15, 2020
1 parent 76f46a8 commit ef212fa
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ public DateTimeControl(string name)

public string DateFormat { get; set; }
public string TimeFormat { get; set; }

private string _dateAsString;
public string DateAsString {
get => _dateAsString ?? (_dateAsString = string.IsNullOrWhiteSpace(DateFormat) ? Value?.ToShortDateString() : Value?.ToString(DateFormat));
public string DateAsString
{
get => _dateAsString ?? (_dateAsString = string.IsNullOrWhiteSpace(DateFormat) ? Value?.ToShortDateString() : Value?.ToString(DateFormat));
set => _dateAsString = value;
}

private string _timeAsString;
public string TimeAsString {
get => _timeAsString ?? (_timeAsString = string.IsNullOrWhiteSpace(TimeFormat) ? Value?.ToShortTimeString().ToUpper() : Value?.ToString(TimeFormat)).ToUpper();
public string TimeAsString
{
get => _timeAsString ?? (_timeAsString = string.IsNullOrWhiteSpace(TimeFormat) ? Value?.ToShortTimeString()?.ToUpper() : Value?.ToString(TimeFormat))?.ToUpper();
set => _timeAsString = value;
}
}
Expand Down

0 comments on commit ef212fa

Please sign in to comment.