Johan Broddfelt

Obstetric pain timer

What do you spend time on when your lady has obstetric pain?

When my wife was pregnant and about to conceive, we looked for a good Obstetric pain timer. We checked out some apps and some web pages, but none of them really showed us what we wanted and in a way that was usable in a mobile phone. So, I did what every parent to be does in this situation. I started to write some code. =)

Obstetric pain timer (English)
Värktimer (Svenska)

jQuery to pure javascript and an issue with the Edge browser

When I wrote the timer I used jQuery but on my blog I want all my code to be pure javascript, so I rewrote the code. And here you can see the difference between jQuery code and pure javascript.

There is one other thing I noticed though. Foolishly enough I tested the code in the Edge browser, where it failed completely, even though it worked fine in chrome. All the numbers from the timer return as NaN. I ran a lot of tests and searched the Internet for an answer and finally i found this old post that gave me some insights to what might cause the problem. The toLocaleTimeString() returns a string with some non-ascii characters in it, thanks for those Microsoft. When I later tried to use parseInt on the string it failed. I just had to create a RegEx that removed the invisible characters and then it worked in the Edge browser as well. If you encounter this problem, look for the removeNonAscii function in my code.


           background: #ff9999;
         }
       
 -     
       
     
     

- javascript, jquery, edge, tolocaletimestring, software

<< Offline Web Application
Follow using RSS
Learn lowercase letters >>

Comment

Name
Mail (Not public)
Send mail updates on new comments
0 comment