[DataMember]
[DisplayFormat(DataFormatString = "{0:MM,yyyy}")]
public virtual Month TaxYearStartMonth { get; set; }
Above is my code and I would just like my dropdown to display the month and year without a day but I keep getting errors.
[DataMember]
[DisplayFormat(DataFormatString = "{0:MM,yyyy}")]
public virtual Month TaxYearStartMonth { get; set; }
Above is my code and I would just like my dropdown to display the month and year without a day but I keep getting errors.
Copyright © 2021 Jogjafile Inc.
It is hard to understand at the first look. But if you look deeper your expected format is "MM,yyyy". This means you need to have your date like this "03,2023" instead of this "2023-03".
But I believe you need to use string instead of Month as type of your property. Because DateTime.Month is integer.
In addition to this change probably you are going to need additional properties to store Month and Year value. And some logic to return this values as TaxYearStartMonth property value.