From 32ede83fd26bf8d92cce8a97dc3754504dc98f23 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Fri, 9 Dec 2022 07:39:27 +0100 Subject: [PATCH] wrong formatting leads to DateTime Now in EditWasteReceiptDialog --- ENI2/Controls/EditWindowBase.cs | 4 +++- ENI2/ENI2.csproj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ENI2/Controls/EditWindowBase.cs b/ENI2/Controls/EditWindowBase.cs index 0f287dcb..4512d3c1 100644 --- a/ENI2/Controls/EditWindowBase.cs +++ b/ENI2/Controls/EditWindowBase.cs @@ -109,6 +109,7 @@ namespace ENI2.Controls thePicker.Value = new DateTime(year, month, day, hour, minute, 0); } catch (FormatException) { } + catch (ArgumentOutOfRangeException) { thePicker.Value = DateTime.Now; } } } @@ -121,10 +122,11 @@ namespace ENI2.Controls string timevalText = rd.Match(thePicker.Text).Captures[0].Value; int day = Int32.Parse(timevalText.Substring(0, 2)); int month = Int32.Parse(timevalText.Substring(2, 2)); - int year = Int32.Parse(timevalText.Substring(4, 4)); + int year = Int32.Parse(timevalText.Substring(4, 4)); thePicker.SelectedDate = new DateTime(year, month, day, 0, 0, 0); } catch (FormatException) { } + catch (ArgumentOutOfRangeException) { thePicker.SelectedDate = DateTime.Now; } } } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 7e7fdc1a..d04528a1 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -84,7 +84,7 @@ - 94D98790E3B6C4CC9F4B57C8FD305E3225894DF8 + F2C2D0164244EC89955EF50201EE24C2A300FF0B true