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

Adding Intl.RelativeDateFormat example #1245

Merged
merged 3 commits into from Dec 4, 2018

Conversation

Projects
None yet
2 participants
@romulocintra
Copy link
Contributor

romulocintra commented Nov 28, 2018

Adding RelativeDateFormat example , according to https://github.com/tc39/proposal-intl-relative-time

@welcome

This comment has been minimized.

Copy link

welcome bot commented Nov 28, 2018

💖 Thanks for opening this pull request! 💖
Here is a list of things that will help get it across the finish line:

  • If this is a new or updated CSS interactive example, please ensure that you followed the CSS styleguide - If this is a new or updated JavaScript interactive example, please ensure that you followed the JavaScript styleguide - If your changes affects any of the steps in our contribution docs, please also make the relevant changes there.

@romulocintra romulocintra changed the title Adding RelativeDateFormat example Adding Intl.RelativeDateFormat example Nov 29, 2018

@wbamberg
Copy link
Member

wbamberg left a comment

Thanks for this!

If possible we should aim to keep examples to 13 lines or less. This example will be embedded in a complete page where there will be lots of space to go into all the different options.

So I think we should just show a couple of options here.

Also I think it would be good to show more different options, rather than lots of calls with very similar arguments. For example, we could do something like:

var rtf1 = new Intl.RelativeTimeFormat('en', { style: 'narrow' });

console.log(rtf1.format(1, 'quarter'));
//expected output: "in 1 qtr."

console.log(rtf1.format(-1, 'month'));
//expected output: "1 day ago"

var rtf2 = new Intl.RelativeTimeFormat('de', { numeric: 'auto' });

console.log(rtf2.format(2, 'day'));
//expected output: "übermorgen"

Also ping @Elchi3 to see if this API is on his radar and if he has any other comments on it.

@romulocintra

This comment has been minimized.

Copy link
Contributor Author

romulocintra commented Dec 1, 2018

@wbamberg completely agree will do changes ... and align it with actual docs

romulocintra added some commits Dec 4, 2018

@wbamberg
Copy link
Member

wbamberg left a comment

Thanks @romulocintra , this looks great :)

@wbamberg wbamberg merged commit 4648996 into mdn:master Dec 4, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk - package.json (schalkneethling) No new issues
Details
@welcome

This comment has been minimized.

Copy link

welcome bot commented Dec 4, 2018

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment