Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

24hto12hformat

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

24hto12hformat

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

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-75.76%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 23 Jul 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc