Exemple #1
0
        /// <inheritdoc/>
        public DateModel Convert(DateTimeOffset sourceMember, ResolutionContext context)
        {
            if (sourceMember == DateTimeOffset.MinValue)
            {
                return(null);
            }

            return(new DateModel
            {
                FullDate = sourceMember,
                Day = sourceMember.Day,
                Month = DateMonthModel.Builder(sourceMember.Month),
                Year = DateYearModel.Builder(sourceMember.Year)
            });
        }
        /// <inheritdoc/>
        public DateTimeModel Convert(DateTimeOffset sourceMember, ResolutionContext context)
        {
            if (sourceMember == DateTimeOffset.MinValue)
            {
                return(null);
            }

            return(new DateTimeModel
            {
                FullDate = sourceMember,
                Day = sourceMember.Day,
                Month = DateMonthModel.Builder(sourceMember.Month),
                Year = DateYearModel.Builder(sourceMember.Year),
                FormattedTime = sourceMember.ToString("HH:mm:ss"),
                Hour = sourceMember.Hour,
                Minute = sourceMember.Minute,
                Second = sourceMember.Second
            });
        }