1.0.0 • Published 2 years ago
value-as-date v1.0.0
To install the package, run the following command
npm install --save value-as-date
This package helps to convert JavaScript Date Object and string date to YYYY-MM-DD
format.
Usage
import { valueAsDate } from 'value-as-date'; // ES6 Module
const { valueAsDate } = require('value-as-date'); // CommonJS
const input = document.getElementById('input-id'); // <input id="input-id" type="date" />
input.value = valueAsDate(new Date()); // alternative to input.valueAsDate = new Date();
console.log(new Date()); // YYYY-MM-DD