-
Notifications
You must be signed in to change notification settings - Fork 195
Add Intl.RelativeTimeFormat #2070
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
base: master
Are you sure you want to change the base?
Conversation
510eddf
to
56e6a6e
Compare
c72fcbf
to
f21142a
Compare
f21142a
to
36dc208
Compare
lib/js_of_ocaml/intl.mli
Outdated
|
||
class type t = object | ||
method format : | ||
(Js.number Js.t -> Js.js_string Js.t -> Js.js_string Js.t) Js.readonly_prop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a readonly_prop and not a method ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ rg "method format\s" -A 1 lib/js_of_ocaml/intl.ml
234: method format : (Js.date Js.t -> Js.js_string Js.t) Js.readonly_prop
235-
--
366: method format : (Js.number Js.t -> Js.js_string Js.t) Js.readonly_prop
367-
--
457: method format :
458- (Js.number Js.t -> Js.js_string Js.t -> Js.js_string Js.t) Js.readonly_prop
Why are all other format
s readonly_prop
?
lib/js_of_ocaml/intl.mli
Outdated
let () = options##.numeric := "auto" in | ||
let () = options##.style := "short" in | ||
let th_rtf = new%js Intl.relativeTimeFormat_constr (def (jas [| "th-TH" |])) options in | ||
fc (th_rtf.format -1 "day"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> (new Intl.RelativeTimeFormat("th-TH", { numeric: "auto", style: "short" })).format(-1, "day")
"เมื่อวาน"
Excepted output for the given language in the browser console.
“This is not correct” isn’t a helpful comment for review. I think I need the ##
but I don’t know what that operator is doing. I believe #
is used for OCaml objects (which are almost never talked about) so I would guess this ##
is something similar but specific to js_of_ocaml
? I am just trying to match the patterns I see in surrounding code to get access to the missing Intl.RelativeTimeFormat
.
0b786f0
to
c8960b2
Compare
Not entirely sure what these are or how they work
c8960b2
to
016d15b
Compare
https://tc39.es/ecma402/#relativetimeformat-objects
NOTE: I do not understand how these comment tests work
1
Footnotes
Please consider giving up MS GitHub or offering a non-proprietary, non-US-corporate-controlled mirror for this free software project. I wish to delete this Microsoft account in the future, but I need more projects like this to support alternative methods to send patches & contribute. ↩