[AI Help] Question: how to format duration with Intl without using experimental APIs? #52
Open
1 of 4 tasks
Labels
bug
Something isn't working
What is the issue with the answer?
Answer formatting is completely broken
![image](https://private-user-images.githubusercontent.com/1223112/319289134-f03fef5e-0d3f-46da-bab3-11f5b3cdedeb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMTQ3MTMsIm5iZiI6MTczOTMxNDQxMywicGF0aCI6Ii8xMjIzMTEyLzMxOTI4OTEzNC1mMDNmZWY1ZS0wZDNmLTQ2ZGEtYmFiMy0xMWY1YjNjZGVkZWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMjI1MzMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWY1YWQxYWVlZTM0NWMxY2U1ZjY1YTEyYzMwNzAyOTRkODFjMDk5Y2I0NmRlZjQ3M2Q1OTJkMzgzYWQ5NWFlZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.tvinVWg_qrS0HkGvjl9Ry72_sbT3e6XNd7drYLSFJGo)
How would you categorize this issue?
What did you ask?
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/ReferenceIntl/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?
The text was updated successfully, but these errors were encountered: