Closed Ryrahul closed 1 year ago
I would like to work on this under hacktober. can u assign this to me
Thank you for your interest in working on this issue! I appreciate your enthusiasm. However, I suggest we wait for the repository maintainer to have a look at the issue first. Once they provide their input, we can collaborate on resolving it together. This way, we can ensure that any changes made align with the project's goals and guidelines. Thanks again for your willingness to contribute!
Thank you for getting back to me. I'm more than happy to wait for the repository maintainer's input and collaborate on resolving the issue together. Please let me know if there's anything specific you would like me to do in the meantime. Thanks again for the opportunity to be a part of this project!
I'm not familiar with this syntax, are you sure you are making an issue for this project?
validator.register('timestamp', {
validate(timestamp) {
// Check if the timestamp is a number.
if (!timestamp || isNaN(timestamp)) {
return false;
}
// Check if the timestamp is within a certain range.
const minTimestamp = 1656480000; // Unix timestamp for 2023-10-01 00:00:00 UTC
const maxTimestamp = Date.now(); // Current Unix timestamp
if (timestamp < minTimestamp || timestamp > maxTimestamp) {
return false;
}
return true;
}});
I believe that this implementation would be simple to implement and easy to use. It would also be flexible enough to meet the needs of most users.
would appreciate it if you would consider adding this change to validator.js.
Thank you for your time and consideration.
Issue
Describe the bug
validator.js does not currently have a built-in feature for validating timestamps.
Examples