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

707
Views
¿Cómo puedo obtener el tiempo hh: mm de ISO sin ninguna diferencia horaria?
createAlarm({ active: true, date: picked_Date.toISOString(), message: 'sample alarm', snooze: 1, });

Creé una alarma usando DatePicker (react-native-date-picker) y react-native-simple-alarm

 ... <Text>{date}</Text> // 2022-02-16T08:47:25.352Z

Solo quiero el valor HH: MM en 24 horas, como 13:42, 09:50 o 22:10. así que probé este código

 <Text>{moment(date).format('hh:mm')}</Text> // 05:47

Esto me dio el valor formado hh: mm, pero el valor no era el mismo que el de mi computadora y el simulador de iOS, se suponía que era a las 08:47, porque la {fecha} era 2022-02-16T08: 47: 25.352Z

¿Cómo puedo deshacerme de la diferencia horaria? y establecer la zona horaria del momento globalmente igual que el hardware (simulador o teléfono)?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

prueba moment.utc() . ajustará su hora de entrada a UTC para que tenga la hora que desee.
también hh:mm dará un reloj de 12 horas, por lo que necesitará HH:mm para un reloj de 24 horas

 //12 hr clock var a = moment.utc('2022-02-16T08:47:25.352Z').format('hh:mm'); var b = moment.utc('2022-02-16T18:47:25.352Z').format('hh:mm'); console.log(a) console.log(b) //24 hr clock var c = moment.utc('2022-02-16T08:47:25.352Z').format('HH:mm'); var d = moment.utc('2022-02-16T18:47:25.352Z').format('HH:mm'); console.log(c) console.log(d)
 <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.2.1/moment.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
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!