@@ -59,6 +59,7 @@ Public Class Update_Gui
5959 Return Resp.ContentLength
6060 End Using
6161 End Function
62+
6263 Public Sub VerifyUpdate()
6364 LogFile.LogTracing( "Verify Update" , LogLvl.LOG_DEBUG, Me )
6465 If WinNUT_Params.Arr_Reg_Key.Item( "VerifyUpdate" ) Or Me .ManualUpdate Then
@@ -73,10 +74,16 @@ Public Class Update_Gui
7374 End Select
7475 Dim Today As Date = Now
7576 Dim Diff As Integer = 1
76- If WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) <> "" Then
77- Dim LastVerif As Date = Convert.ToDateTime(WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ))
78- Diff = DateDiff(DelayVerif, LastVerif, Today, FirstDayOfWeek.Monday, FirstWeekOfYear.Jan1)
77+ Dim lastCheckDate = WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" )
78+
79+ If lastCheckDate <> "" Then
80+ Try
81+ Diff = DateDiff(DelayVerif, Convert.ToDateTime(lastCheckDate), Today)
82+ Catch ex As FormatException
83+ LogFile.LogTracing( "Format exception when parsing last check date: " + lastCheckDate, LogLvl.LOG_ERROR, Me )
84+ End Try
7985 End If
86+
8087 If Diff >= 1 Or ManualUpdate Then
8188 Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
8289 WebC.Headers.Add(Net.HttpRequestHeader.Accept, "application/json" )
@@ -137,7 +144,9 @@ Public Class Update_Gui
137144 Catch excep As Exception
138145 LogFile.LogTracing(excep.Message, LogLvl.LOG_ERROR, Me )
139146 End Try
140- WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) = Now.ToString
147+
148+ ' Use the 's' format to get a standard datetime for error-free parsing in the future.
149+ WinNUT_Params.Arr_Reg_Key.Item( "LastDateVerification" ) = Date .Now.ToString( "s" )
141150 WinNUT_Params.Save_Params()
142151 Me .UpdateInfoRetrieved = True
143152 Me .Show()
0 commit comments