修复按年的时间lessthan判断bug

This commit is contained in:
xuejiaming 2022-02-23 14:02:50 +08:00
parent d328fcfdfb
commit 6281772eb1
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ namespace ShardingCore.VirtualRoutes.Years
return tail => String.Compare(tail, t, StringComparison.Ordinal) >= 0;
case ShardingOperatorEnum.LessThan:
{
var currentYear =new DateTime(shardingKey.Year);
var currentYear =new DateTime(shardingKey.Year,1,1);
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
if (currentYear == shardingKey)
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;

View File

@ -71,7 +71,7 @@ namespace ShardingCore.VirtualRoutes.Years
case ShardingOperatorEnum.LessThan:
{
var datetime = ShardingCoreHelper.ConvertLongToDateTime(shardingKey);
var currentYear = new DateTime(datetime.Year);
var currentYear = new DateTime(datetime.Year,1,1);
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
if (currentYear == datetime)
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;