Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GalNet broken with some Arabic calendars #64

Closed
irongut opened this issue Apr 17, 2021 · 4 comments · Fixed by #66
Closed

GalNet broken with some Arabic calendars #64

irongut opened this issue Apr 17, 2021 · 4 comments · Fixed by #66
Assignees
Labels
bug Something isn't working GalNet GalNet News

Comments

@irongut
Copy link
Owner

irongut commented Apr 17, 2021

Bug Report

GalNet News does not work with Arabic, Saudi Arabia (ar_sa) calendar.

NewsArticleConverter.SetProperty (Newtonsoft.Json.JsonReader reader, EDlib.GalNet.NewsArticle item)
System.FormatException: String was not recognized as a valid DateTime.

App Center Issue 1550929719

Stack Trace

System    DateTimeParse.Parse (System.ReadOnlySpan`1[T] s, System.Globalization.DateTimeFormatInfo dtfi, System.Globalization.DateTimeStyles styles)
System    DateTime.Parse (System.String s, System.IFormatProvider provider)
System    Convert.ToDateTime (System.String value, System.IFormatProvider provider)
System.String.System    IConvertible.ToDateTime (System.IFormatProvider provider)
System    Convert.ToDateTime (System.Object value)
EDlib.GalNet    NewsArticleConverter.SetProperty (Newtonsoft.Json.JsonReader reader, EDlib.GalNet.NewsArticle item)
EDlib.GalNet    NewsArticleConverter.ReadJson (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue, Newtonsoft.Json.JsonSerializer serializer)
Newtonsoft.Json.Serialization    JsonSerializerInternalReader.DeserializeConvertable (Newtonsoft.Json.JsonConverter converter, Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue)
Newtonsoft.Json.Serialization    JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent)
Newtonsoft.Json    JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType)
Newtonsoft.Json    JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType)
Newtonsoft.Json    JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings)
Newtonsoft.Json    JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonConverter[] converters)
Newtonsoft.Json    JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonConverter[] converters)
EDlib.GalNet    GalNetService+<>c__DisplayClass8_0.<GetData>b__0 ()
System.Threading.Tasks    Task.InnerInvoke ()
System.Threading.Tasks    Task.Execute ()
EDlib.GalNet    GalNetService.GetData (System.Int32 articleCount, System.Int32 expiryHours, System.Threading.CancellationTokenSource cancelToken, System.Boolean ignoreCache)
EDlib.GalNet    GalNetService.GetData (System.Int32 expiryHours, System.Threading.CancellationTokenSource cancelToken, System.Boolean ignoreCache)
EliteALD.ViewModels    NewsViewModel.GetGalNetNewsAsync (System.Threading.CancellationTokenSource cancelToken, System.Boolean ignoreCache)

To Reproduce

Steps to reproduce the behavior:

  1. Set calendar to Arabic, Saudi Arabia (ar_sa).
  2. Run app.
  3. Open GalNet.

Expected Behavior

GalNet parses & displays correctly.

Additional Context

Priorities, server status, BGS tick & CGs have no date issues but year is 42.

Arabic (ar_ar) & Arabic, United Arab Emirates (ar_ua) do not have these issues. Other Arabic calendars should be tested.

Firebase Screenshots

Linked To

#51 Errors with non-Western calendars
#63 Standings broken with some Arabic calendars
irongut/EliteALD Issue 304 GalNet & Standings broken with some Arabic calendars

@irongut irongut added the bug Something isn't working label Apr 17, 2021
@irongut irongut self-assigned this Apr 17, 2021
@irongut irongut added the GalNet GalNet News label Apr 17, 2021
@irongut
Copy link
Owner Author

irongut commented Apr 19, 2021

Broken (12)

Arabic, Comoros (ar_KM)
Arabic, World (ar_001)
Arabic, Djibouti (ar_DJ)
Arabic, Western Sahara (ar_EH)
Arabic, Eritrea (ar_ER)
Arabic, Mauritania
Arabic, Palestine
Arabic, Saudi Arabia (ar_SA)
Arabic, Somalia
Arabic, South Sudan
Arabic, Sudan
Arabic, Chad

Working (16)

Arabic (ar)
Arabic, United Arab Emirates (ar_AE)
Arabic, Bahrain (ar_BH)
Arabic, Algeria (ar_DZ)
Arabic, Egypt (ar_EG)
Arabic, Iraq (ar_IQ)
Arabic, Jordan (ar_JO)
Arabic, Kuwait (ar_KW)
Arabic, Lebanon (ar_LB)
Arabic, Libya (ar_LY)
Arabic, Morocco (ar_MA)
Arabic, Oman
Arabic, Qatar
Arabic, Syria
Arabic, Tunisia
Arabic, Yemen

@irongut
Copy link
Owner Author

irongut commented Apr 21, 2021

NewsArticleConverter.cs parses each article publish date & time on line 73. Passing a culture to the Convert.ToDateTime() call should fix the issue. Similar to recent fix for BGS Tick.

@irongut
Copy link
Owner Author

irongut commented Apr 22, 2021

The Islamic Hijri calendar is the official calendar in countries around the Gulf, especially Saudi Arabia. Based on a lunar cycle and dates from the Prophet Muhammad's flight from Makkah to Madinah. The Islamic year (AH) averages 354 days and recedes by about 11 days a year against the Gregorian calendar.

Calendar Date
Hijri 08 / 09 / 1442
GREGORIAN 20 / 04 / 2021

@irongut irongut pinned this issue Apr 25, 2021
irongut added a commit that referenced this issue Apr 25, 2021
@irongut
Copy link
Owner Author

irongut commented Apr 25, 2021

An issue remains with the date displayed by the consuming app not appearing.
image

The relevant Label controls are bound to NewsArticle.PublishDate which needs culture in a DateTime.ToString() call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GalNet GalNet News
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant