Skip to content

Commit 5037e56

Browse files
committed
DateParser_1.0.6337.38019 branch creation.
1 parent d1f9101 commit 5037e56

File tree

194 files changed

+7662
-32702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+7662
-32702
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Master source code](https://github.com/varocarbas/FlexibleParser/tree/master/all_code/DateParser/Source)
44

5-
[https://customsolvers.com/date_parser/](https://customsolvers.com/date_parser/) (ES: [https://customsolvers.com/date_parser_es/](https://customsolvers.com/date_parser_es/)) -- [NuGet package](https://www.nuget.org/packages/DateParser/)
5+
[https://customsolvers.com/date_parser/](https://customsolvers.com/date_parser/) (ES: [https://customsolvers.com/date_parser_es/](https://customsolvers.com/date_parser_es/)) -- [NuGet package](https://www.nuget.org/packages/DateParser/) -- [Video](https://www.youtube.com/watch?v=E2JT2w66uyc)
66

77
## Introduction
88

README.md

Lines changed: 85 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,105 @@
1-
# FlexibleParser
1+
# DateParser
22

3-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.439945.svg)](https://doi.org/10.5281/zenodo.439945) [![Build Status](https://travis-ci.org/varocarbas/FlexibleParser.svg?branch=master)](https://travis-ci.org/varocarbas/FlexibleParser)
3+
[Master source code](https://github.com/varocarbas/FlexibleParser/tree/master/all_code/DateParser/Source)
44

5+
[https://customsolvers.com/date_parser/](https://customsolvers.com/date_parser/) (ES: [https://customsolvers.com/date_parser_es/](https://customsolvers.com/date_parser_es/)) -- [NuGet package](https://www.nuget.org/packages/DateParser/) -- [Video](https://www.youtube.com/watch?v=E2JT2w66uyc)
56

6-
FlexibleParser is a multi-purpose .NET parsing library based upon the following ideas:
7+
## Introduction
78

8-
- Intuitive, adaptable and easy to use.
9-
- Pragmatic, but aiming for the maximum accuracy and correctness.
10-
- Overall compatible and easily automatable.
11-
- Formed by independent DLLs managing specific situations.
9+
After adding a reference to the ```FlexibleParser``` namespace, it is possible to start using DateParser right away. The main functionalities of this library can be divided in the following two groups:
10+
- ```DateTime``` type (C#) enhancements: better string parsing, easier linkage to time zone information and easier modification of constituent elements.
11+
- Time zones: relevant amount of additional information and more user-friendly usage.
1212

13-
## Parts
13+
All the public classes of DateParser have some common features meant to maximise their usability and compatibility. For example, implicit conversions to multiple types or custom ```ToString()``` versions outputting the most adequate information.
1414

15-
At the moment, FlexibleParser is formed by the following independent parts:
15+
```C#
16+
//dateP.Value is identical to DateTime.Parse("01-01-2001").
17+
DateP dateP = new DateP("01-01-2001");
18+
dateP = "01-01-2001";
1619

17-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.439729.svg)](https://doi.org/10.5281/zenodo.439729) [UnitParser](https://customsolvers.com/unit_parser/) ([last release](https://github.com/varocarbas/FlexibleParser/releases/tag/UnitParser__1.0.6301.23655), [readme file](https://github.com/varocarbas/FlexibleParser/blob/master/all_readme/UnitParser.md), [code analysis](https://varocarbas.com/unit_parser_code/))<br/>
18-
It allows to easily deal with a wide variety of situations involving units of measurement.
19-
Among its most salient features are: user-defined exception triggering and gracefully managing numeric values of any size.
20+
//dateP.Value has the same date than DateTime.ParseExact("02-01-2001", "dd-MM-yyyy", CultureInfo.CurrentCulture)
21+
//and the current time.
22+
dateP = new DateP("02-01-2001", new CustomDateTimeFormat("day-month-year"));
2023

24+
//timeZoneWindows.TimeZoneInfo is identical to TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time").
25+
//Note that TimeZoneInfo.FindSystemTimeZoneById("E Europe Standard Time") triggers an exception.
26+
TimeZoneWindows timeZoneWindows = new TimeZoneWindows(TimeZoneWindowsEnum.E_Europe_Standard_Time);
27+
timeZoneWindows = TimeZoneWindowsEnum.E_Europe_Standard_Time;
28+
```
2129

22-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.439942.svg)](https://doi.org/10.5281/zenodo.439942) [NumberParser](https://customsolvers.com/number_parser/) ([last release](https://github.com/varocarbas/FlexibleParser/releases/tag/NumberParser_1.0.6302.28051), [readme file](https://github.com/varocarbas/FlexibleParser/blob/master/all_readme/NumberParser.md), [code analysis](https://varocarbas.com/number_parser_code/))<br/>It provides a common framework for all the .NET numeric types. Main features: exceptions managed internally; beyond-double-range support; custom mathematical functionalities.
30+
## DateP
2331

32+
```DateP``` is the main class of DateParser and improves ```DateTime``` in the following ways:
33+
- It enables new alternatives to extract the date/time information from strings via ```CustomDateTimeFormat```.
34+
- It allows real-time modifications of the ```DateTime``` constituent parts, including the offset of the associated time zone.
2435

25-
[DateParser](https://customsolvers.com/date_parser/) ([last release](https://github.com/varocarbas/FlexibleParser/tree/master/all_code/DateParser/Source), [readme file](https://github.com/varocarbas/FlexibleParser/blob/master/all_readme/DateParser.md))<br/>It enhances the default .NET date/time support, mostly via improving the usability of its main type and accounting for a big amount of additional time zone information.
2636

37+
```C#
38+
string[] inputs = new string[]
39+
{
40+
"04-05-2017", "4-may-2017", "04/5-2017", "04 05 2017"
41+
};
2742

28-
## Authorship & Copyright
43+
foreach (string input in inputs)
44+
{
45+
DateP dateP = new DateP
46+
(
47+
input, new CustomDateTimeFormat
48+
(
49+
new DateTimeParts[]
50+
{
51+
DateTimeParts.Day, DateTimeParts.Month, DateTimeParts.Year
52+
}
53+
),
54+
0m
55+
);
56+
57+
//dateP.Value has always the same date than DateTime.ParseExact("04-05-2017", "dd-MM-yyyy", CultureInfo.CurrentCulture)
58+
//and the current time.
59+
//Note that DateTime.ParseExact requires specific arguments to deal with each input string.
60+
}
61+
62+
//The date of dateP.Value has become 05/05/2017, the first Friday after 04/05/2017.
63+
dateP.Week = DayOfWeek.Friday;
64+
65+
//The time of dateP.Value is now 3 hours later, the lag between the new offset and the original one.
66+
dateP.TimeZoneOffset = 3m;
67+
```
68+
69+
## Time Zones
70+
71+
DateParser supports 6 different types of time zones, each of them is defined by a main class and an enum:
72+
- [```TimeZoneOfficial```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Official/TimeZones_Types_Official_Constructors.cs)/[```TimeZoneOfficialEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Official/Hardcoding/TimeZones_Types_Official_Hardcoding_Main.cs).
73+
- [```TimeZoneIANA```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/IANA/TimeZones_Types_IANA_Constructors.cs)/[```TimeZoneIANAEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/IANA/Hardcoding/TimeZones_Types_IANA_Hardcoding_Main.cs).
74+
- [```TimeZoneConventional```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Conventional/TimeZones_Types_Conventional_Constructors.cs)/[```TimeZoneConventionalEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Conventional/TimeZones_Types_Conventional_Hardcoding.cs).
75+
- [```TimeZoneUTC```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/UTC/TimeZones_Types_UTC_Constructors.cs)/[```TimeZoneUTCEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/UTC/TimeZones_Types_UTC_Hardcoding.cs).
76+
- [```TimeZoneWindows```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Windows/TimeZones_Types_Windows_Constructors.cs)/[```TimeZoneWindowsEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Windows/TimeZones_Types_Windows_Hardcoding.cs).
77+
- [```TimeZoneMilitary```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Military/TimeZones_Types_Military_Constructors.cs)/[```TimeZoneMilitaryEnum```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Types/Military/TimeZones_Types_Military_Hardcoding.cs).
78+
79+
There are also two other classes dealing with various time zones at the same time:
80+
- [```TimeZones```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Basic/Constructors/MainClass/TimeZones_Basic_Constructors_MainClass_Main.cs).
81+
- [```TimeZonesCountry```](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/DateParser/Source/TimeZones/Country/TimeZones_Country_Constructors.cs).
2982

83+
84+
```C#
85+
//All the information about the CET time zone.
86+
TimeZoneOfficial timeZoneOfficial = "CET";
87+
88+
//Time zones of all the types having something in common with the CET time zone.
89+
TimeZones timezones = new TimeZones(timeZoneOfficial);
90+
91+
//List with all the pairs of official standard/daylight time zones used in Ponferrada's country (i.e., Spain).
92+
TimeZonesCountry timeZonesCountry = new TimeZonesCountry("Ponferrada");
93+
```
94+
95+
## Further Code Samples
96+
The [test application](https://github.com/varocarbas/FlexibleParser/blob/master/all_code/Test/Parts/DateParser.cs) includes a relevant number of descriptive code samples.
97+
98+
## Authorship & Copyright
3099
I, Alvaro Carballo Garcia (varocarbas), am the sole author of each single bit of this code.
31100

32101
Equivalently to what happens with all my other online contributions, this code can be considered public domain. For more information about my copyright/authorship attribution ideas, visit the corresponding pages of my sites:
33102
- https://customsolvers.com/copyright/<br/>
34103
ES: https://customsolvers.com/copyright_es/
35104
- https://varocarbas.com/copyright/<br/>
36-
ES: https://varocarbas.com/copyright_es/
105+
ES: https://varocarbas.com/copyright_es/

all_binaries/NumberParser.dll

-124 KB
Binary file not shown.

all_binaries/UnitParser.dll

-174 KB
Binary file not shown.

all_code/NumberParser/LICENSE

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)