Add Intl.RelativeTimeFormat#2070
Open
toastal wants to merge 3 commits intoocsigen:masterfrom
Open
Conversation
510eddf to
56e6a6e
Compare
c72fcbf to
f21142a
Compare
hhugo
reviewed
Jul 24, 2025
f21142a to
36dc208
Compare
hhugo
reviewed
Jul 29, 2025
|
|
||
| class type t = object | ||
| method format : | ||
| (Js.number Js.t -> Js.js_string Js.t -> Js.js_string Js.t) Js.readonly_prop |
Member
There was a problem hiding this comment.
Why is this a readonly_prop and not a method ?
Contributor
Author
There was a problem hiding this comment.
$ 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_propWhy are all other formats readonly_prop?
hhugo
reviewed
Jul 29, 2025
hhugo
reviewed
Jul 29, 2025
hhugo
reviewed
Jul 29, 2025
hhugo
reviewed
Jul 29, 2025
| 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"); |
Contributor
Author
There was a problem hiding this comment.
> (new Intl.RelativeTimeFormat("th-TH", { numeric: "auto", style: "short" })).format(-1, "day")
"เมื่อวาน" Expected 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
c8960b2 to
016d15b
Compare
016d15b to
9cad447
Compare
9cad447 to
9ed2188
Compare
Not entirely sure what these are or how they work
9ed2188 to
5251d4b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. ↩