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

time-input-formatter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

time-input-formatter

Interpret and format a user inputted time string or partial time string to 12hr or 24hr time

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status Coverage Status dependencies Status npm version

time-input-formatter

Interpret and format a user inputted time string or partial time string to 12hr or 24hr time

This library contains es5 and es6 implementations in the deliverable and is fully tree-shakable for es6.

Version: 1.0.0

deriveTimeFormat

Derive a time format from a user inputted string

Since v1.0.0

ParamType

value

The input value to derive the format
string

format

The desired output format
Format

Returns: {ParsedTime}

Supporting Types
export type Format = '12hm' | '12hms' | '24hm' | '24hms';
export type ParsedTime = { valid: boolean, value: string };
Import
import { deriveTimeFormat, Format, ParsedTime } from 'time-input-formatter';
Input12hm Output12hms Output24hm Output24hms Output
77:00 AM7:00:00 AM07:0007:00:00
7a7:00 AM7:00:00 AM07:0007:00:00
7am7:00 AM7:00:00 AM07:0007:00:00
7p7:00 PM7:00:00 PM19:0019:00:00
7007:00 AM7:00:00 AM07:0007:00:00
07007:00 AM7:00:00 AM07:0007:00:00
7157:15 AM7:15:00 AM07:1507:15:00
715277:15 AM7:15:27 AM07:1507:15:27
164:00 PM4:00:00 PM16:0016:00:00
012:00 AM12:00:00 AM00:0000:00:00
2712:00 AM12:00:00 AM00:0000:00:00

License

MIT

Author

Michael Paravano

Dependencies

@paravano/utils ^1.4.0
date-fns ^2.21.1

Keywords

FAQs

Package last updated on 24 Apr 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