minutes-to-string
v1.0.0
Published
Converts a number of minutes into a user-friendly string.
Downloads
1
Maintainers
Readme
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'