Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
React Native - Trying to use a masked input for dd-mon-yyyy date format

Using react-native-mask-input library from npm , I'm trying to use custom function for 12-Jun-2022 kind of date input - however this outputs only 12- , I'd appreciate it if someone can point me in the right direction

dateMask = (text) => {

     const cleanText = text.replace(/\D+/g, '');

     let secondDigitDayMask = /\d/;

     if (cleanText.charAt(0) === '0') {
         secondDigitDayMask = /[1-9]/;
     }
     if (cleanText.charAt(0) === '3') {
         secondDigitDayMask = /[01]/;
     }

     let secondDigitMonthMask = /\d/;

     let monthMask = /((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))/

     if (cleanText.charAt(2) === '0') {
         secondDigitMonthMask = /[1-9]/;
     }
     if (cleanText.charAt(2) === '1') {
         secondDigitMonthMask = /[012]/;
     }

     return [
         /[0-3]/,
         secondDigitDayMask,
         '-',
         monthMask,
         '-',
         /\d/,
         /\d/,
         /\d/,
         /\d/,
     ];

 }

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!