Fix bug with TODAY in Wikidata schema

This commit is contained in:
Antonin Delpeuch 2020-01-06 11:40:14 +01:00
parent 1046c38727
commit ae41348e00
2 changed files with 2 additions and 2 deletions

View File

@ -112,7 +112,7 @@ public class WbDateConstant implements WbExpression<TimeValue> {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
TimeValue todaysDate = Datamodel.makeTimeValue( TimeValue todaysDate = Datamodel.makeTimeValue(
calendar.get(Calendar.YEAR), calendar.get(Calendar.YEAR),
(byte)calendar.get(Calendar.MONTH), (byte)(calendar.get(Calendar.MONTH)+1),
(byte)calendar.get(Calendar.DAY_OF_MONTH), (byte)calendar.get(Calendar.DAY_OF_MONTH),
(byte)0, (byte)0, (byte)0, (byte)11, 0,0,0, TimeValue.CM_GREGORIAN_PRO); (byte)0, (byte)0, (byte)0, (byte)11, 0,0,0, TimeValue.CM_GREGORIAN_PRO);
return todaysDate; return todaysDate;

View File

@ -95,7 +95,7 @@ public class WbDateConstantTest extends WbExpressionTest<TimeValue> {
TimeValue expectedDate = Datamodel.makeTimeValue( TimeValue expectedDate = Datamodel.makeTimeValue(
calendar.get(Calendar.YEAR), calendar.get(Calendar.YEAR),
(byte)calendar.get(Calendar.MONTH), (byte)calendar.get(Calendar.MONTH),
(byte)calendar.get(Calendar.DAY_OF_MONTH), (byte)(calendar.get(Calendar.DAY_OF_MONTH)+1),
(byte)0, (byte)0, (byte)0, (byte)11, 0,0,0, TimeValue.CM_GREGORIAN_PRO); (byte)0, (byte)0, (byte)0, (byte)11, 0,0,0, TimeValue.CM_GREGORIAN_PRO);
evaluatesTo(expectedDate, new WbDateConstant("TODAY")); evaluatesTo(expectedDate, new WbDateConstant("TODAY"));
} }