commodo-fields-date
A simple date field, used with the Commodo withFields
higher order function.
Install
npm install --save commodo-fields-date
Or if you prefer yarn:
yarn add commodo-fields-date
Quick Example:
;;; const Company = ; const company = ;companyname = "Acme Corporation"; // The date field can accept a Date object... companyfoundedOn = ;companytopMoments = ; // ...or an ISO 8601 formatted date/time string.companyfoundedOn = "2020-04-18T15:50:44.205Z";companytopMoments = "2020-04-18T15:50:44.205Z" "2020-04-10T00:00:00.000Z" ; // The following will throw the WithFieldsError error.companyfoundedOn = "2020-04-18";companytopMoments = "2020-04-18" ;
Note: alternatively, you could've also used the populate
method to assign the data:
const company = ;companypopulate = foundedOn: topMoments: "2020-04-18T15:50:44.205Z" "2020-04-10T00:00:00.000Z" ;
Contributors
Thanks goes to these wonderful people (emoji key):
Adrian Smijulj 💻 📖 💡 👀 ⚠️ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!