Socket
Socket
Sign inDemoInstall

@scoir/date

Package Overview
Dependencies
3
Maintainers
27
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @scoir/date

The date utility provides a formatter and isCredibleDate utility


Version published
Weekly downloads
122
decreased by-17.01%
Maintainers
27
Created
Weekly downloads
 

Readme

Source

Date

The date utility provides a formatter and isCredibleDate utility

Usage - formatter

Use the format method with your date and an option configuration object. The configuration can take defaultText, inputFormat, and an outputFormat.

import { formatter } from '@scoir/date';

class ExampleComp extends React.Component {
    static propTypes = { someDate: PropTypes.string }
    render () {
        const formattedDate = formatter.format(this.props.someDate, {
                defaultText: '—',
                inputFormat: 'MM-DD-YYYY',
                outputFormat: 'ddd, hA',
            })
        ...
    }
    ...
}

Usage - isCredibleDate

A method returning a boolean for a non-falsy and non-zero-date date input

import { isCredibleDate } from '@scoir/date';

class ExampleComp extends React.Component {
    static propTypes = { someDate: PropTypes.string }
    render () {
        const isNotTrashGarbage = isCredibleDate(this.props.someDate)
        ...
    }
    ...
}

FAQs

Last updated on 09 May 2022

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