minutes-to-string

1.0.0 • Public • Published

Minutes To String

Converts a number of minutes into a user-friendly string, e.g. 80 minutes becomes '1 hour & 20 minutes'.

Installation

npm install minutes-to-string --save

Usage

Import and reference the minutesToString function like so:

const minutesToString = require('minutes-to-string');
const timeString = minutesToString(80); // returns '1 hour & 20 minutes'

Arguments

When calling the minutesToString function, you can pass it two arguments to alter its behavior. The first argument is the number of minutes you want converted to a string. The second argument is a separator between the hours and minutes string that is returned.

Details of each argument are below:

minutes (number) (required)
Default value: none
The number of minutes you want converted to a string.

separator (string) (optional)
Default value: ' &'
The string that separates the number of hours and minutes listed. Examples could include:

  • ' and' would return '1 hour and 20 minutes'
  • ',' would return '1 hour, 20 minutes'

Package Sidebar

Install

npm i minutes-to-string

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

2.98 kB

Total Files

3

Last publish

Collaborators

  • adammy