-
Notifications
You must be signed in to change notification settings - Fork 603
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
Support formatting units, eg. secs, days #252
Comments
This is a must have as far as I'm concerned. Would be glad to help if needed. Display week dates // Globalize initialization omitted
function formatWeek(startDate) {
var startDate = new Date(startDate);
// _ is gettext
var i18nString = _('%s of %s to %s');
var i18nWeek = Globalize.formatUnit( 1, "week" );
var i18nFirstDay = Globalize.formatDate(startDate, {skeleton: 'yMd'});
var i18nLastDay = Globalize.formatDate(startDate.setDate(startDate.getDate() + 6), language, {skeleton: 'yMd'});
return util.format(i18nString, i18nWeek, i18nFirstDay, i18nLastDay);
} |
#252 perfectly fits my needs. I'd be glad to help and will look into documenting it whenever I have free time. |
Awesome, feel free to add comments needing help. As soon as we get those items tick, it should be good to land on master. |
Ecma proposal |
Thanks to @sompylasar Ref #252 Ref #254 Ref #512 Ref #541
Thanks to @AhmedMustafa Ref #252 Ref #254 Ref #512 Ref #541
PR #254
Format units such as seconds, minutes, days, weeks, and everything else supported by CLDR.
Requires
API
.formatUnit( value, unit [, options] );
Examples:
Value: Number
Unit: String, eg. "month", "day", etc.
Options:
Specs
CLDR
Units can be found on main//units.json.
Ecma proposal
Fore more background: see #391.
The text was updated successfully, but these errors were encountered: