File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ func (s *builderTestSuite) TestBuilder_Valid() {
4545 WithIdentificationStatus (true ).
4646 WithIdentificationType (string (RfidNone )).
4747 AddReading (Reading {
48- Time : "2018-07-24T13:22:04,000+0200" ,
48+ Time : "2018-07-24T13:22:04,000+0200 S " ,
4949 ReadingValue : 123 ,
5050 ReadingUnit : string (UnitskWh ),
5151 Status : string (MeterOk ),
@@ -56,7 +56,7 @@ func (s *builderTestSuite) TestBuilder_Valid() {
5656 s .Equal (true , builder .payload .IdentificationStatus )
5757 s .Equal (string (RfidNone ), builder .payload .IdentificationType )
5858 s .Len (builder .payload .Readings , 1 )
59- s .Equal ("2018-07-24T13:22:04,000+0200" , builder .payload .Readings [0 ].Time )
59+ s .Equal ("2018-07-24T13:22:04,000+0200 S " , builder .payload .Readings [0 ].Time )
6060 s .Equal (float64 (123 ), builder .payload .Readings [0 ].ReadingValue )
6161 s .Equal (string (UnitskWh ), builder .payload .Readings [0 ].ReadingUnit )
6262 s .Equal (string (MeterOk ), builder .payload .Readings [0 ].Status )
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ func currentTypeValidator(fl validator.FieldLevel) bool {
7171 return isValidCurrentType (CurrentType (fl .Field ().String ()))
7272}
7373
74- var iso8601WithMillisRegex = regexp .MustCompile (`^(?:19|20) \d{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:Z|-0[1-9]|-1\d|-2[0-3]|-00:?(?:0[1-9]|[1-5]\d)|\+[01]\d|\+2[0-3])(?:|:?[0-5]\d) $` )
74+ var iso8601WithMillisRegex = regexp .MustCompile (`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2},\d{3}[+-]\d{4} [S|U|I|R] $` )
7575
7676func iso8601WithMillisValidator (fl validator.FieldLevel ) bool {
7777 return iso8601WithMillisRegex .MatchString (fl .Field ().String ())
You can’t perform that action at this time.
0 commit comments