Enforce 8–100 age range for character creation (DOB bounds, validation, translations) #272
      
        
          +148
        
        
          −105
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary
This PR ensures character birthdates are realistic by enforcing a minimum age of 8 and a maximum age of 100. It adds front-end limits to the date picker, hard validation in
CharacterValidator, a sensible default DOB, and new translation strings for friendly error messages.What’s changed
1)
app.jsminDOBandmaxDOB(today−100y, today−8y).registerData.datetoyearsAgo(21)on mount and when resetting the form.registerData.dateand clamps any manual input/paste into the allowed range.localISO()andyearsAgo()utilities so dates are timezone-safe (local YYYY-MM-DD).2)
validation.jsisTooYoung(value, 8)andisTooOld(value, 100); integrates them into thedatevalidators array.parseISODate()andtodayUTC()to avoid timezone edge cases.isValidDatefocused purely on real dates; age range is enforced separately.3)
index.html(or your Vue template):min="minDOB"and:max="maxDOB"on<v-date-picker>so users can only pick valid birthdays.4) Translations
JS / i18n (if you keep translations in JS)
Rationale
How to test
Open the character creation form.
Verify the date picker won’t allow dates newer than today−8y or older than today−100y.
Try manually typing a too-young date (e.g., 7y 364d ago) → should show
age_too_young.Try manually typing a too-old date (e.g., 100y + 1 day ago) → should show
age_too_old.Boundary checks:
Try an invalid calendar date (e.g.,
2023-02-30) → should showinvalid_date.Confirm successful creation with an in-range DOB (e.g., 21y ago).
Backward compatibility
Security / performance
Commit summary
Checklist (maintainers/authors)
Have you loaded this code into an updated QBCore project and tested all functionality?
Does your code fit the style guidelines?
Does your PR fit the contribution guidelines?