Skip to content

Commit d64792f

Browse files
authored
Merge pull request #53 from Irwin1985/jsfox
Validate hour in DD/MM/YYYY HH:MM:SS and Empty dates return
2 parents f76630c + a1425a4 commit d64792f

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

JSONFox.PJT

165 Bytes
Binary file not shown.

JSONFox.pjx

0 Bytes
Binary file not shown.

jsonfox.app

162 Bytes
Binary file not shown.

src/jsonclass.prg

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ define class JSONClass as session
44
LastErrorText = ""
55
lError = .f.
66
lShowErrors = .t.
7-
version = "9.15"
7+
version = "9.16"
88
hidden lInternal
99
hidden lTablePrompt
1010
Dimension aCustomArray[1]

src/jsonutils.prg

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ define class jsonutils as custom
3333
this.aPattern[5,2] = .t.
3434

3535
&& "DD/MM/YYYY HH:MM:SS" or "DD-MM-YYYY HH:MM:SS"
36-
this.aPattern[06,1] = "^([0-2][0-9]|(3)[0-1])[\/-](((0)[0-9])|((1)[0-2]))[\/-]\d{4} (\d{2}):(\d{2}):(\d{2})$"
36+
this.aPattern[06,1] = "^([0-2][0-9]|(3)[0-1])[\/-](((0)[0-9])|((1)[0-2]))[\/-]\d{4} (00|0?[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])$"
3737
this.aPattern[06,2] = .t.
3838

3939
&& "DD/MM/YY" or "DD-MM-YY"
4040
this.aPattern[07,1] = "^([0-2][0-9]|(3)[0-1])[\/-](((0)[0-9])|((1)[0-2]))[\/-]\d{2}$"
4141
this.aPattern[07,2] = .t.
4242

4343
&& "DD/MM/YY HH:MM:SS" or "DD-MM-YY HH:MM:SS"
44-
this.aPattern[08,1] = "^([0-2][0-9]|(3)[0-1])[\/-](((0)[0-9])|((1)[0-2]))[\/-]\d{2} (\d{2}):(\d{2}):(\d{2})$"
44+
this.aPattern[08,1] = "^([0-2][0-9]|(3)[0-1])[\/-](((0)[0-9])|((1)[0-2]))[\/-]\d{2} (00|0?[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])$"
4545
this.aPattern[08,2] = .t.
4646

4747
_screen.oRegEx.global = .t.
@@ -89,7 +89,7 @@ define class jsonutils as custom
8989
For i = 1 to Alen(this.aPattern, 1)
9090
_screen.oRegEx.pattern = this.aPattern[i, 1]
9191
if _screen.oRegEx.Test(tcString)
92-
return this.formatDate(tcString, this.aPattern[i, 2])
92+
return Evl(this.formatDate(tcString, this.aPattern[i, 2]), tcString)
9393
endif
9494
EndFor
9595
* It is a normal String

0 commit comments

Comments
 (0)