~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/Sharpen/Sharpen/SimpleDateFormat.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
        public class SimpleDateFormat : DateFormat
7
7
        {
8
8
                string format;
 
9
 
 
10
                CultureInfo Culture {
 
11
                        get; set;
 
12
                }
 
13
 
 
14
                bool Lenient {
 
15
                        get; set;
 
16
                }
9
17
                
10
18
                public SimpleDateFormat (): this ("g")
11
19
                {
17
25
 
18
26
                public SimpleDateFormat (string format, CultureInfo c)
19
27
                {
 
28
                        Culture = c;
20
29
                        this.format = format.Replace ("EEE", "ddd");
21
30
                        this.format = this.format.Replace ("Z", "zzz");
22
31
                        SetTimeZone (TimeZoneInfo.Local);
23
32
                }
24
33
 
 
34
                public bool IsLenient ()
 
35
                {
 
36
                        return Lenient;
 
37
                }
 
38
 
 
39
                public void SetLenient (bool lenient)
 
40
                {
 
41
                        Lenient = lenient;
 
42
                }
 
43
 
 
44
                public override DateTime Parse (string value)
 
45
                {
 
46
                        if (IsLenient ())
 
47
                                return DateTime.Parse (value);
 
48
                        else
 
49
                                return DateTime.ParseExact (value, format, Culture);
 
50
                }
 
51
 
25
52
                public override string Format (DateTime date)
26
53
                {
27
54
                        date += GetTimeZone().BaseUtcOffset;