Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Use the isDate
validator to check for valid date strings for the birthday field, and use the len
(or length) validator to allow a password value only if it falls within a specific length (or an expected range) of characters.
Date formats
The DATEONLY
data type follows the ISO international date format. It formats the date as: YYYY-MM-DD
.
You could set the value to '12-02-2000', for example, or even 'December 2, 2000', and Sequelize would still format it to ISO 8601 for the database. This ensures that all dates are stored in a consistent format.
Resources
- Per-attribute validations
- A thread regarding the Moment.js deprecation warning you may notice in the console when entering dates that are not in ISO format
- Use international date format (ISO)
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up