date2obj
Parse Date to Simple Object in JavaScript
💥 Zero dependencies
Usage
npm i date2obj --save
// Get current time // Equal to the first one // Put Date object in the function to get that time
const date2obj = ; const currentTime = ;console;// Local time// {// year: 'YYYY',// month: 'MM',// day: 'DD',// hour: 'HH',// minute: 'mm',// second: 'SS'// } const otherTime = ;console;// Local time with the epoch// {// year: "2018",// month: "02",// day: "14",// hour: "02",// minute: "12",// second: "55"// }
Configuration Options
usage with options
fields
default: ['year', 'month', 'day', 'hour', 'minute', 'second']
usage example:
const otherTime = ;console;// Local time with the epoch// {// hour: "02",// minute: "12",// second: "55"// }
License
MIT