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

hof-component-date

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hof-component-date

A hof middleware for rendering and processing 3 part date fields

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

#HOF-Component-Date

A component for handling the rendering and processing of 3-input date fields used in HOF Applications.

##Usage

In your fields config:

const dateComponent = require('hof-component-date');

module.exports = {
  'date-field': dateComponent('date-field', {
    validate: ['required', 'before']
  })
}

The above example will create a new date component with the key 'date-field' and will apply the validators required and before (before today).

##Configuration

The following optional configuration options are supported:

  • validate {String|Array} - validators to use on the processed date field
  • template - an absolute path to an alternate template.
  • dayOptional {Boolean} - day defaults to 01 if omitted. Defaults to false
  • monthOptional {Boolean} - month defaults to 01 if omitted. If true then also forces dayOptional to be true. Defaults to false

##Labels

The three intermedate fields have fallback labels of Day, Month and Year, however custom labels can be used by including the translation at the following path:

fields.json

{
  "field-name": {
    "parts": {
      "day": {
        "label": "Custom Day Label"
      },
      "month": {
        "label": "Custom Month Label"
      },
      "year": {
        "label": "Custom Year Label"
      }
    }
  }
}

FAQs

Package last updated on 05 Jun 2017

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