commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Better way to handle DateTime parameters

Open gsscoder opened this issue 2 years ago • 1 comments

As for now it seems that a DateTime option is simply parsed and therefore converted to local time

It should be possible to keep the date in UTC

gsscoder avatar Jan 28 '23 17:01 gsscoder

Very True. We could probably add an additional property on the OptionAttribute would work. Or a ParsingOptions property for specifying DateTime(Offset) conversion handling.

public class MyOptions
{
    [Option("d", DateTimeParsing=DateTimeParsing.Utc]
    public DateTime SomeDateTime { get; set; }
}

ericnewton76 avatar Mar 07 '23 18:03 ericnewton76