Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't control DateTime representations in Example #258

Closed
masters3d opened this issue Mar 20, 2018 · 2 comments
Closed

Can't control DateTime representations in Example #258

masters3d opened this issue Mar 20, 2018 · 2 comments

Comments

@masters3d
Copy link

masters3d commented Mar 20, 2018

code:

    class Options
    {
        [Option("startDate", Required = true, HelpText = "The start of the date range. yyyy-mm-dd")]
        public DateTime StartDate { get; set; }

        [Option("endDate", Required = true, HelpText = "The end of the date range. yyyy-mm-dd")]
        public DateTime EndDate { get; set; }

        [Usage(ApplicationAlias = "myExe")]
        public static IEnumerable<Example> Examples
        {
            get
            {
                var dateA = DateTime.Now.AddDays(-7);
                var dateB = DateTime.Now;
                yield return new Example("Normal scenario", new Options { StartDate = dateA, EndDate = dateB });
            }
        }
     }

command line:

Normal scenario:
myExe --endDate 3/20/2018 11:46:56 AM --startDate 3/13/2018 11:46:56 AM

desired:
myExe --endDate 2018-03-20 --startDate 2018-03-18

@tmtiwari
Copy link

Appears to be Duplicate of #502

@moh-hassan
Copy link
Collaborator

online demo to show the fix in v2.7+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants