Skip to content

formatCelsius

Rounds a temperature and appends the Celsius unit. It is intended for display labels where whole-degree precision is enough.

Importing

ts
import { formatCelsius } from '@almighty-shogun/utils'

Usage

ts
import { formatCelsius } from '@almighty-shogun/utils'

const label = formatCelsius(21.6);

// '22 °C'

Parameters

NameTypeDescription
temperaturenumberTemperature value.

Returns

A formatted Celsius string.

Type signature

ts
declare function formatCelsius(temperature: number): string;

All packages are released under the MIT License.