You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
I am using this library to help with parsing strings on react native, with luxon. Android has some issues with toLocaleString so following this comment I am using this library which is super nice. Apart from I cannot get "long" to work in toLocaleString.
import{DateTime}from"luxon"import{Platform}from"react-native"if(Platform.OS==="android"){require("intl")require("intl/locale-data/jsonp/en")require("intl/locale-data/jsonp/nl")}constgetPrettyDate=(date: DateTime)=>{returndate.toLocaleString({weekday: "long",month: "long",day: "2-digit",})}test("getPrettyDate",()=>{expect(getPrettyDate(DateTime.fromRFC2822("Fri, 25 Nov 2016 12:00:00 +0000"))).toBe(`Friday, November 25`)})
This will fail on Android because it produces the string "Fri, Nov 25" instead of the "long" variant which should be "Friday, November 25". On iOS devices, the above test will pass.
The intl require statements are definitely working, since if I remove the require statements, then
getPrettyDate will produce something like "Friday, November 25, 2016, 12:00..".
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using this library to help with parsing strings on react native, with luxon. Android has some issues with toLocaleString so following this comment I am using this library which is super nice. Apart from I cannot get "long" to work in toLocaleString.
This will fail on Android because it produces the string "Fri, Nov 25" instead of the "long" variant which should be "Friday, November 25". On iOS devices, the above test will pass.
The intl require statements are definitely working, since if I remove the require statements, then
getPrettyDate will produce something like "Friday, November 25, 2016, 12:00..".
The text was updated successfully, but these errors were encountered: