Skip to content

mrknip/js-written-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-written-time

Takes a time of format HH:mm and turns it into language-specific natural language representation of clock time

getWrittenTime('1:10') => ten past one
getWrittenTime('1:15') => quarter past one
getWrittenTime('12:00') => midday
getWrittenTime('15:45') => quarter to four
getWrittenTime('15:50', { showDayPeriod: true }) => 'ten to four in the afternoon'
getWrittenTime('13:30', { language: 'de' }) => 'halb zwei'

Options

All passed as second parameter, e.g. getWrittenTime('1:20', { language: 'de', });

prop default description
language 'en' The language in which to display the output.
isAtStartOfSentence false If true will format the output appropriately
showDayPeriod false If true will add information to 12 hour output (e.g. '12.50' => 'ten to one in the afternoon'

About

Display written forms of times

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published