comparison lib/js/urweb.js @ 1632:4682b312e9d5

Fix client-side [int] parsing and extend server-side [time] parsing to support a format that also works portably in JavaScript
author Adam Chlipala <adam@chlipala.net>
date Sun, 04 Dec 2011 16:32:06 -0500
parents 747f94ac5fc2
children b0720700c36e
comparison
equal deleted inserted replaced
1631:747f94ac5fc2 1632:4682b312e9d5
141 } 141 }
142 142
143 function stringToTime_error(string) { 143 function stringToTime_error(string) {
144 var t = Date.parse(string); 144 var t = Date.parse(string);
145 if (isNaN(t)) 145 if (isNaN(t))
146 onFail("Invalid date string: " + string); 146 er("Invalid date string: " + string);
147 else 147 else
148 return t * 1000; 148 return t * 1000;
149 } 149 }
150 150
151 function stringToTime(string) { 151 function stringToTime(string) {
960 return s.length >= len; 960 return s.length >= len;
961 } 961 }
962 962
963 function trimZeroes(s) { 963 function trimZeroes(s) {
964 for (var i = 0; i < s.length; ++i) 964 for (var i = 0; i < s.length; ++i)
965 if (s[i] != '0') { 965 if (s.charAt(i) != '0') {
966 if (i > 0) 966 if (i > 0)
967 return s.substring(i); 967 return s.substring(i);
968 else 968 else
969 return s; 969 return s;
970 } 970 }