mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
fix: 🐛 Fixed the issue parsing TheMovieDB dates. They have broken something...
This commit is contained in:
parent
e335a2b81a
commit
6e397e02e9
2 changed files with 22 additions and 4 deletions
|
@ -71,7 +71,7 @@ namespace Ombi.Mapping.Profiles
|
|||
.ForMember(x => x.ReleaseDate, o => o.MapFrom(s => s.release_dates))
|
||||
.ForMember(x => x.IsoCode, o => o.MapFrom(s => s.iso_3166_1));
|
||||
CreateMap<ReleaseDate, ReleaseDateDto>()
|
||||
.ForMember(x => x.ReleaseDate, o => o.MapFrom(s => s.release_date))
|
||||
.ForMember(x => x.ReleaseDate, o => o.MapFrom(s => s.ReleaseDateTime))
|
||||
.ForMember(x => x.Type, o => o.MapFrom(s => s.Type));
|
||||
|
||||
CreateMap<TheMovieDbApi.Models.Genre, GenreDto>();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -74,10 +75,27 @@ namespace Ombi.TheMovieDbApi.Models
|
|||
|
||||
public class ReleaseDate
|
||||
{
|
||||
public string Certification { get; set; }
|
||||
public string iso_639_1 { get; set; }
|
||||
public string note { get; set; }
|
||||
public DateTime release_date { get; set; }
|
||||
public string release_date { get; set; }
|
||||
[JsonIgnore]
|
||||
public DateTime ReleaseDateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DateTime.TryParse(release_date,out var formattedDate))
|
||||
{
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
if (DateTime.TryParseExact(release_date, "yyyy-MM-dd hh:mm:ss UTC",
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.None, out var excatDate))
|
||||
{
|
||||
return excatDate;
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
public int Type { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue