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

[AI Help] Question: how to format duration with Intl without using experimental APIs? #52

Open
1 of 4 tasks
shadow-identity opened this issue Apr 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@shadow-identity
Copy link

shadow-identity commented Apr 3, 2024

What is the issue with the answer?

Answer formatting is completely broken
image

How would you categorize this issue?

  • The answer is harmful / unsafe.
  • The answer is not correct.
  • The answer is not helpful.
  • The answer is outdated.

What did you ask?

  1. how to format duration with Intl without using experimental APIs?

What did AI Help answer?

.mozilla.org/en-US/docs/WebI'm sorry, but I can't provide guidance on formatting durations with the Intl/JavaScript API without referring to experimental APIs, as the standard method for/Reference/Global formatting durations in JavaScript_Objects, /IntlIntl.DurationFormat,/Number is currentlyFormat), marked as [Intl experimental..DateTimeFormat](https This API://developer.mozilla.org/en-US is specifically designed to/docs/Web handle duration/JavaScript formatting according/Reference to different locales,/Global which is_Objects a common requirement for internationalized/Intl applications.

For non-experimental/DateTime APIs relatedFormat), to and [Intl,Intl.C you can explore otherollator parts of the Intl``](https://developer.mozilla.org object that/en-US are stable and widely/docs/Web supported,/JavaScript such as/Reference Intl/Global.DateTimeFormat_Objects./JavaScript/Reference/Global However, these do_Objects not directly address duration/Intl/DateTimeFormat) formatting.

for formattingIf you dates and need to times, format durations or [ and preferIntl.Number to avoidFormat]( experimental APIshttps://developer.mozilla, you.org/en-US/docs/Web/JavaScript/Reference/ might considerGlobal_Objects/Intl/NumberFormat) for formatting numbers. These can sometimes be creatively used to format certain parts of durations, but they won't provide a comprehensive solution for formatting complex durations out of the box.

If you need to format durations and implementing a cannot use the experimental Intl custom formatting.DurationFormat due function or to compatibility concerns, using a library that provides duration you might formatting capabilities. Libraries like [Moment.js](https need to implement custom://moment formatting logicjs.com or use a third/) or [date-party library that provides-fns duration formatting](https capabilities. Libraries like moment://date.jshttps://momentjs offer robust.com/) or [ solutions fordate-f handling datesns]( and timeshttps://date-f, including duration formatting, but please verify their current status and support as libraries evolvens.org/) have over time been popular.

Remember choices for handling dates, the status of and times in JavaScript web APIs, including can change duration formatting, so, though it's it's always good a good to check the current state of library support idea to check the current compatibility and status and community recommendations, as the of JavaScript ecosystemIntl.Duration evolves rapidlyFormat.

Remember on MD, while libraries canN or offer powerful and convenient other documentation solutions, they also add to sources to your project see if's dependency it has footprint. moved beyond Always weigh experimental status. the benefits against the potential costs in terms of bundle size and maintenance.

For the most accurate and up-to-date information, please refer to the official MDN documentation and validate whether the Intl.DurationFormat has reached a stable stage or if any new APIs have been introduced to handle durations.

What MDN pages did AI Help consult?

@shadow-identity shadow-identity added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Apr 3, 2024
@caugner caugner added bug Something isn't working and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Apr 19, 2024
@caugner
Copy link
Contributor

caugner commented Apr 19, 2024

Hi @shadow-identity, 👋

Thank you for reporting this issue. It looks like a hiccup of our API, as I have never seen that before, and I cannot reproduce it either.

Two questions for you:

  1. How often did you experience this issue?
  2. If more than once, are you still experiencing this?

@shadow-identity
Copy link
Author

Hi @caugner ,

  1. Never had it neither before nor after, but at the day I reported the issue I had it several times.
  2. Now it answers with a pretty formatted message "I'm sorry, but I can't answer questions outside web development." 🥴

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

No branches or pull requests

2 participants