Skip to content

Commit

Permalink
Merge pull request #4 from AMSaiian/develop
Browse files Browse the repository at this point in the history
Minor fix with dateTime kind
  • Loading branch information
AMSaiian authored Sep 17, 2024
2 parents f52c383 + 5520304 commit 6f82e92
Showing 1 changed file with 51 additions and 9 deletions.
60 changes: 51 additions & 9 deletions backend/src/App/Taskio.Domain/Entities/Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,33 @@ public class Task : BaseEntity, IOrdering, IFiltered<Task>, IRanged<Task>
entity.DueDate.HasValue
&& filters
.Select(entry => DateTime
.Parse(entry, CultureInfo.InvariantCulture))
.SpecifyKind(DateTime
.Parse(entry,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc))
.Contains(entity.DueDate.Value)
},
{
TaskConstants.FilteredBy.CreatedDate, filters => entity => filters
.Select(entry => DateTime
.Parse(entry, CultureInfo.InvariantCulture))
.SpecifyKind(DateTime
.Parse(entry,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc))
.Contains(entity.CreatedAt)
},
{
TaskConstants.FilteredBy.UpdatedDate, filters => entity =>
entity.UpdatedAt.HasValue
&& filters
.Select(entry => DateTime
.Parse(entry, CultureInfo.InvariantCulture))
.SpecifyKind(DateTime
.Parse(entry,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc))
.Contains(entity.UpdatedAt.Value)
}
});
Expand All @@ -85,18 +97,48 @@ public class Task : BaseEntity, IOrdering, IFiltered<Task>, IRanged<Task>
{
TaskConstants.RangedBy.DueDate, (start, end) =>
entity => entity.DueDate.HasValue
&& entity.DueDate >= DateTime.Parse(start, CultureInfo.InvariantCulture)
&& entity.DueDate <= DateTime.Parse(end, CultureInfo.InvariantCulture)
&& entity.DueDate >= DateTime
.SpecifyKind(DateTime
.Parse(start,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
&& entity.DueDate <= DateTime
.SpecifyKind(DateTime
.Parse(end,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
},
{
TaskConstants.RangedBy.CreatedDate, (start, end) =>
entity => entity.CreatedAt >= DateTime.Parse(start, CultureInfo.InvariantCulture)
&& entity.CreatedAt <= DateTime.Parse(end, CultureInfo.InvariantCulture)
entity => entity.CreatedAt >= DateTime
.SpecifyKind(DateTime
.Parse(start,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
&& entity.CreatedAt <= DateTime
.SpecifyKind(DateTime
.Parse(end,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
},
{
TaskConstants.RangedBy.UpdatedDate, (start, end) =>
entity => entity.UpdatedAt >= DateTime.Parse(start, CultureInfo.InvariantCulture)
&& entity.UpdatedAt <= DateTime.Parse(end, CultureInfo.InvariantCulture)
entity => entity.UpdatedAt >= DateTime
.SpecifyKind(DateTime
.Parse(start,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
&& entity.UpdatedAt <= DateTime
.SpecifyKind(DateTime
.Parse(end,
CultureInfo.InvariantCulture,
DateTimeStyles.AdjustToUniversal),
DateTimeKind.Utc)
}
});
}

0 comments on commit 6f82e92

Please sign in to comment.