Socket
Socket
Sign inDemoInstall

24hto12hformat

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    24hto12hformat

Converts from 24-hour hh:mm to 12-hour hh:mm +merdian


Version published
Weekly downloads
5
decreased by-64.29%
Maintainers
1
Install size
65.9 kB
Created
Weekly downloads
 

Readme

Source

24hto12hformat

Converts from 24-hour hh:mm to 12-hour hh:mm +merdian or hh:mm:ss +merdian format.

Usage

Install:

yarn add 24hto12hformat
# or
npm install 24hto12hformat --save

In your code:

import timeFormatter from '24hto12hformat';

timeFormatter('13:30'); // => 1:30 pm
// same as timeFormatter('13:30', false);
// but
timeFormatter('13:30', true); // => 1:30 PM

// works fine
timeFormatter('15:33:29 GMT+020'); // => 3:33 pm

// to add seconds:
timeFormatter('13:30', true, true); // => 1:30:00 PM
timeFormatter('13:30:13', true, true); // => 1:30:13 PM

Contract

/**
 *
 * @param {string} time
 * @param {boolean} uppercase
 * @param {boolean} includeSeconds
 * @return {string}
 */

If the the supplied time argument is not a string, or it does not start in the hh:mm format, then the module will throw an exception in the form of a string.

Other Notes

Fun fact: the original name of this package (24h-to-12h-format) could not be published to NPM due to their system considering it a spam name. :)

Keywords

FAQs

Last updated on 23 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc