Skip to content

[DateType]

IntelliTect.Coalesce.DataAnnotations.DateTypeAttribute

WARNING

This attribute is deprecated and not recommended for use in new development. Instead, use the native .NET types System.DateOnly and System.TimeOnly.

Specifies whether a DateTime type will have a date and a time, or only a date.

Example Usage

c#
public class Person
{
    public int PersonId { get; set; }

    [DateType(DateTypeAttribute.DateTypes.DateOnly)]
    public DateTimeOffset? BirthDate { get; set; }
}

Properties

// Also settable via constructor parameter #1
public DateTypes DateType { get; set; } = DateTypes.DateTime; 

The type of date the property represents.

Enum values are:

  • DateTypeAttribute.DateTypes.DateTime Subject is both a date and time.
  • DateTypeAttribute.DateTypes.DateOnly Subject is only a date with no significant time component.
  • DateTypeAttribute.DateTypes.TimeOnly Subject is only a time with no significant date component.

Coalesce is a free and open-source framework created by IntelliTect to fill our desire to create better apps, faster. IntelliTect is a high-end software architecture and development consulting firm based in Spokane, Washington.

If you're looking for help with your software project, whether it be a Coalesce application, other technologies, or even just an idea, reach out to us at info@intellitect.com — we'd love to start a conversation! Our clients range from Fortune 100 companies to local small businesses and non-profits.