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

midday

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

midday

Converts 24-hour (military) time string to 12-hour (meridiem) time string and vice versa.

  • 21.7.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-0.27%
Maintainers
1
Weekly downloads
 
Created
Source

Meridiem time Tweet

Build Status License NPM version Website NPM downloads

Converts 24-hour (military) time string to 12-hour (meridiem) time string and vice versa..

Usage

npm install midday --save
import { toMeridiem, toMilitary } from 'midday';

/**
 * Converts 24-hour (military) time string to 12-hour (meridiem) time string.
 * @param {string} time The time string ("00:30", "01:45", "12:00", "22:15").
 * @return {string} Return converted 24-hour time string to 12-hour time.
 * @throws {Error} Will throw an error if the time string is invalid.
 */
toMeridiem('00:30'); // 12:30 AM
toMeridiem('01:15'); // 1:15 AM
toMeridiem('11:45'); // 11:45 AM
toMeridiem('12:15'); // 12:15 PM
toMeridiem('13:15'); // 1:15 PM
toMeridiem('23:15'); // 11:15 PM
toMeridiem('0030');  // 12:30 AM
toMeridiem('2315');  // 11:15 PM

/**
 * Converts 12-hour (meridiem) time string to 24-hour (military) time string.
 * @param {string} time The time string ("12:30 AM", "11:15 PM", "1:15 AM").
 * @return {string} Return converted 12-hour time string to 24-hour time.
 * @throws {!Error} Will throw an error if the time string is invalid.
 */
toMilitary('12:30 AM'); // 00:30
toMilitary('1:15 AM');  // 01:15
toMilitary('11:45 AM'); // 11:45
toMilitary('12:15 PM'); // 12:15
toMilitary('1:15 PM');  // 13:15
toMilitary('11:15 PM'); // 23:15

For more information please visit Glize project page.

Keywords

FAQs

Package last updated on 07 Jul 2021

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