How to use the @automattic/format-currency.getCurrencyObject function in @automattic/format-currency

To help you get started, we’ve selected a few @automattic/format-currency examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / my-sites / feature-upsell / themes-upsell.jsx View on Github external
formatPrice( price ) {
		const priceObject = getCurrencyObject( price, this.props.currencyCode );
		if ( price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
			return `${ priceObject.symbol }${ priceObject.integer }${ priceObject.fraction }`;
		}
		return `${ priceObject.symbol }${ priceObject.integer }`;
	}
github Automattic / wp-calypso / client / my-sites / feature-upsell / store-upsell.jsx View on Github external
renderPrice() {
		if ( this.props.price === null ) {
			return null;
		}
		const priceObject = getCurrencyObject( this.props.price, this.props.currencyCode );
		let price = `${ priceObject.symbol }${ priceObject.integer }`;
		if ( this.props.price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
			price += priceObject.fraction;
		}
		return price;
	}
}
github Automattic / wp-calypso / client / my-sites / feature-upsell / plugins-upsell.jsx View on Github external
formatPrice( price ) {
		const priceObject = getCurrencyObject( price, this.props.currencyCode );
		if ( price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
			return `${ priceObject.symbol }${ priceObject.integer }${ priceObject.fraction }`;
		}
		return `${ priceObject.symbol }${ priceObject.integer }`;
	}
github Automattic / wp-calypso / client / my-sites / feature-upsell / ads-upsell.jsx View on Github external
renderPrice() {
		if ( this.props.price === null ) {
			return null;
		}
		const priceObject = getCurrencyObject( this.props.price, this.props.currencyCode );
		let price = `${ priceObject.symbol }${ priceObject.integer }`;
		if ( this.props.price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
			price += priceObject.fraction;
		}
		return price;
	}
}
github Automattic / wp-calypso / client / my-sites / plan-interval-discount / index.js View on Github external
getDiscountPriceObject() {
		const { currencyCode, discountPrice, originalPrice } = this.props;
		return getCurrencyObject( originalPrice - discountPrice, currencyCode );
	}
github Automattic / wp-calypso / client / extensions / woocommerce / components / price-input / index.js View on Github external
render() {
		const {
			currency,
			currencySetting,
			initialValue,
			siteId,
			translate,
			value,
			...props
		} = this.props;

		const displayCurrency = ! currency && currencySetting ? currencySetting.value : currency;
		const currencyObject = getCurrencyObject( value, displayCurrency );
		let resetButton;
		if ( initialValue ) {
			if ( initialValue === this.state.value ) {
				resetButton = <span>;
			} else {
				resetButton = (
					<button aria-label="{">
						
					</button>
				);
			}</span>

@automattic/format-currency

JavaScript library for formatting currency.

GPL-2.0
Latest version published 5 months ago

Package Health Score

92 / 100
Full package analysis