@@ -49,14 +49,16 @@ public virtual bool IsGroupable
49
49
50
50
if (route != null && route.PropertyRouteType == PropertyRouteType.FieldOrProperty)
51
51
{
52
+
if (route.Type == typeof(Date))
53
+
return true;
54
+
52
55
var pp = Validator.TryGetPropertyValidator(route);
53
56
if (pp != null)
54
57
{
55
58
DateTimePrecisionValidatorAttribute? datetimePrecision = pp.Validators.OfType<DateTimePrecisionValidatorAttribute>().SingleOrDefaultEx();
56
59
57
60
if (datetimePrecision != null && datetimePrecision.Precision == DateTimePrecision.Days)
58
61
return true;
59
-
60
62
}
61
63
}
62
64
@@ -158,6 +160,9 @@ protected List<QueryToken> SubTokensBase(Type type, SubTokensOptions options, Im
158
160
if (ut == typeof(DateTime))
159
161
return DateTimeProperties(this, DateTimePrecision.Milliseconds).AndHasValue(this);
160
162
163
+
if (ut == typeof(Date))
164
+
return DateProperties(this).AndHasValue(this);
165
+
161
166
if (ut == typeof(float) || ut == typeof(double) || ut == typeof(decimal))
162
167
return StepTokens(this, 4).AndHasValue(this);
163
168
@@ -247,6 +252,26 @@ public static List<QueryToken> DateTimeProperties(QueryToken parent, DateTimePre
247
252
}.NotNull().ToList();
248
253
}
249
254
255
+
public static List<QueryToken> DateProperties(QueryToken parent)
256
+
{
257
+
string utc = TimeZoneManager.Mode == TimeZoneMode.Utc ? "Utc - " : "";
258
+
259
+
return new List<QueryToken?>
260
+
{
261
+
new NetPropertyToken(parent, ReflectionTools.GetPropertyInfo((Date dt)=>dt.Year), () => utc + QueryTokenMessage.Year.NiceToString()),
262
+
new NetPropertyToken(parent, ReflectionTools.GetMethodInfo((Date dt ) => dt.Quarter()), ()=> utc + QueryTokenMessage.Quarter.NiceToString()),
263
+
new DatePartStartToken(parent, QueryTokenMessage.QuarterStart),
264
+
new NetPropertyToken(parent, ReflectionTools.GetPropertyInfo((Date dt)=>dt.Month),() => utc + QueryTokenMessage.Month.NiceToString()),
265
+
new DatePartStartToken(parent, QueryTokenMessage.MonthStart),
266
+
new NetPropertyToken(parent, ReflectionTools.GetMethodInfo((Date dt ) => dt.WeekNumber()), ()=> utc + QueryTokenMessage.WeekNumber.NiceToString()),
267
+
new DatePartStartToken(parent, QueryTokenMessage.WeekStart),
268
+
new NetPropertyToken(parent, ReflectionTools.GetPropertyInfo((Date dt)=>dt.Day), () => utc + QueryTokenMessage.Day.NiceToString()),
269
+
new NetPropertyToken(parent, ReflectionTools.GetPropertyInfo((Date dt)=>dt.DayOfYear), () => utc + QueryTokenMessage.DayOfYear.NiceToString()),
270
+
new NetPropertyToken(parent, ReflectionTools.GetPropertyInfo((Date dt)=>dt.DayOfWeek), () => utc + QueryTokenMessage.DayOfWeek.NiceToString()),
271
+
272
+
}.NotNull().ToList();
273
+
}
274
+
250
275
public static List<QueryToken> StepTokens(QueryToken parent, int decimals)
251
276
{
252
277
return new List<QueryToken?>
@@ -390,7 +415,11 @@ static string GetNiceTypeName(Type type, Implementations? implementations)
390
415
case FilterType.Integer: return QueryTokenMessage.Number.NiceToString();
391
416
case FilterType.Decimal: return QueryTokenMessage.DecimalNumber.NiceToString();
392
417
case FilterType.String: return QueryTokenMessage.Text.NiceToString();
393
-
case FilterType.DateTime: return QueryTokenMessage.DateTime.NiceToString();
418
+
case FilterType.DateTime:
419
+
if (type.UnNullify() == typeof(Date))
420
+
return QueryTokenMessage.Date.NiceToString();
421
+
422
+
return QueryTokenMessage.DateTime.NiceToString();
394
423
case FilterType.Boolean: return QueryTokenMessage.Check.NiceToString();
395
424
case FilterType.Guid: return QueryTokenMessage.GlobalUniqueIdentifier.NiceToString();
396
425
case FilterType.Enum: return type.UnNullify().NiceName();
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4