javascript - Removing a timestamp with a JS regular expression -


so i'm beginner js , regexps sore spot me. need remove timestamp dropdowns. here how appears:

<option value="aqua">   <span>aqua - available ship 2013-05-29 01:02:00.0 - $18.00</span> </option> 

i have if statement appending available ship text , date @ end. think need grab date. i'm thinking either chop off after date or remove timestamp regex. issue i'm having lot of trouble getting either of these work. here if statement.

if ((index == selectors.length || (selectors.length > 1 && key !== 'color')) && product.availability.online.fulfillment != null) {         var date = product.availability.online.fulfillment         value.text = product.options[key] + ' - available ship ' + date + ' - $' + product.price.value; } 

thanks in advance!

to remove:

date = date.substring(0, date.indexof(' ')); 

regex replace:

date = date.replace(/[01][0-9]:[0-5][0-9]:[0-9]{2}.[0-9]/, ''); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -