[longomatch] Prevent error parsing date depending on the localisation



commit 8ca0423199420e82e65fa632d33a14cfed57b3e7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Sep 23 18:51:16 2009 +0200

    Prevent error parsing date depending on the localisation

 LongoMatch/Gui/Component/ProjectDetailsWidget.cs |   19 ++++---------------
 LongoMatch/Gui/Component/ProjectListWidget.cs    |    2 +-
 2 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index be86e34..b74e8e7 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -47,6 +47,7 @@ namespace LongoMatch.Gui.Component
 		private Project project;
 		private LongoMatch.Video.Utils.PreviewMediaFile mFile;
 		private bool edited;
+		private DateTime date;
 		private CalendarPopup cp;
 		private Win32CalendarDialog win32CP;
 		private Sections actualSection;
@@ -132,22 +133,10 @@ namespace LongoMatch.Gui.Component
 		}
 		
 		public DateTime Date{  
-			get {
-				//HACK See bug http://bugzilla.gnome.org/show_bug.cgi?id=592934
-				//dateEntry is not editable and we set the date manually
-				//Why do we get this error?
-				DateTime date;
-				try{
-					date = DateTime.Parse(dateEntry.Text);
-				}
-				catch{
-					date = DateTime.Now;
-				}                               
-				return date;
-			}
-			
+			get {return date;}			
 			set {
-				dateEntry.Text = value.ToString(Catalog.GetString("MM/dd/yyyy"));
+				date = value;
+				dateEntry.Text = value.ToShortDateString();
 			}
 		}			
 			
diff --git a/LongoMatch/Gui/Component/ProjectListWidget.cs b/LongoMatch/Gui/Component/ProjectListWidget.cs
index f8176d4..f831566 100644
--- a/LongoMatch/Gui/Component/ProjectListWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectListWidget.cs
@@ -85,7 +85,7 @@ namespace LongoMatch.Gui.Component
 			text = text +"\n"+Catalog.GetString("<b>Season:</b>  ") + _project.Season;
 			text = text +"\n"+Catalog.GetString("<b>Competition:</b>  ") + _project.Competition;
 			text = text +"\n"+Catalog.GetString("<b>Result:</b>  ") + _project.LocalGoals+"-"+_project.VisitorGoals;
-			text = text +"\n"+Catalog.GetString("<b>Date:</b>  ") + _project.MatchDate.ToString(Catalog.GetString("MM/dd/yyyy"));
+			text = text +"\n"+Catalog.GetString("<b>Date:</b>  ") + _project.MatchDate.ToShortDateString();
 			
 			(cell as Gtk.CellRendererText).Markup = text;	
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]