Skip to content

Commit

Permalink
fix issue with default date and default order on advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Jan 24, 2023
1 parent 914047b commit 6857de3
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using SharedLibraryCore.Dtos
@using WebfrontCore.QueryHelpers.Models
@using Data.Models
@using System.Globalization
@model string
@{
var existingClientFilter = ViewBag.ClientResourceRequest as ClientResourceRequest;
Expand Down Expand Up @@ -97,14 +98,14 @@
<div class="form-group">
<label for="clientConnected@(Model)">@ViewBag.Localization["WEBFRONT_ADVANCED_SEARCH_LABEL_CONNECTED_SINCE"]</label>
<div class="d-flex">
@{ var oneYearAgo = DateTime.UtcNow.AddYears(-1).ToShortDateString(); }
@{ var presetDate = (existingClientFilter?.ClientConnected ?? DateTime.UtcNow.AddYears(-1)).ToString("s", CultureInfo.InvariantCulture); }
<input type="text" class="form-control date-picker-input w-half" name="clientConnected"
id="clientConnected@(Model)" data-date="@oneYearAgo"
value="@(existingClientFilter?.ClientConnected?.ToShortDateString() ?? oneYearAgo)"/>
id="clientConnected@(Model)" data-date="@presetDate"
value="@presetDate"/>

<div class="custom-control ml-10 align-self-center">
<div class="custom-switch">
@if (existingClientFilter?.Direction is SortDirection.Descending)
@if ((existingClientFilter?.Direction ?? SortDirection.Descending) is SortDirection.Descending)
{
<input type="checkbox" id="resultOrder@(Model)" name="direction"
value="@((int)SortDirection.Ascending)">
Expand Down

0 comments on commit 6857de3

Please sign in to comment.