Find Jobs
Hire Freelancers

update this javascript function

$30-250 USD

En curso
Publicado hace más de 14 años

$30-250 USD

Pagado a la entrega
Need the date sort part to work for AM/PM date times. Currently the time only works for 24 hours times. ----------------------------------------------------------------------------------------------- var Sort = (function(){ var sort = {}; // Default alpha-numeric sort // -------------------------- [login to view URL] = function(a,b) { return (a==b)?0:(a<b)?-1:1; }; sort['default'] = [login to view URL]; // IE chokes on [login to view URL] // This conversion is generalized to work for either a decimal separator of , or . sort.numeric_converter = function(separator) { return function(val) { if (typeof(val)=="string") { multi = ([login to view URL]('-')==-1) ? 1 : -1; val = multi * parseFloat([login to view URL](/^[^\d\.]*([\d., ]+).*/g,"$1").replace(new RegExp("[^\\\d"+separator+"]","g"),'').replace(/,/,'.')) || 0; } return val || 0; }; }; // Numeric Sort // ------------ [login to view URL] = function(a,b) { return [login to view URL](a)[login to view URL](b); }; [login to view URL] = sort.numeric_converter("."); // Numeric Sort - comma decimal separator // -------------------------------------- sort.numeric_comma = function(a,b) { return [login to view URL](a)[login to view URL](b); }; [login to view URL] = sort.numeric_converter(","); // Case-insensitive Sort // --------------------- [login to view URL] = function(a,b) { return [login to view URL]([login to view URL](a),[login to view URL](b)); }; [login to view URL] = function(val) { if (val==null) { return ""; } return (""+val).toLowerCase(); }; // Currency Sort // ------------- [login to view URL] = [login to view URL]; // Just treat it as numeric! sort.currency_comma = sort.numeric_comma; // Date sort // --------- [login to view URL] = function(a,b) { return [login to view URL]([login to view URL](a),[login to view URL](b)); }; // Convert 2-digit years to 4 sort.date.fixYear=function(yr) { yr = +yr; if (yr<50) { yr += 2000; } else if (yr<100) { yr += 1900; } return yr; }; [login to view URL] = [ // YY[YY]-MM-DD { re:/(\d{2,4})-(\d{1,2})-(\d{1,2})/ , f:function(x){ return (new Date([login to view URL](x[1]),+x[2],+x[3])).getTime(); } } // MM/DD/YY[YY] or MM-DD-YY[YY] ,{ re:/(\d{1,2})[\/-](\d{1,2})[\/-](\d{2,4})/ , f:function(x){ return (new Date([login to view URL](x[3]),+x[1],+x[2])).getTime(); } } // Any catch-all format that new Date() can handle. This is not reliable except for long formats, for example: 31 Jan 2000 01:23:45 GMT ,{ re:/(.*\d{4}.*\d+:\d+\d+.*)/, f:function(x){ var d=new Date(x[1]); if(d){return [login to view URL]();} } } ]; [login to view URL] = function(val) { val=[login to view URL](/[a-z,A-Z]/g,''); var m,v, f = [login to view URL]; for (var i=0,L=[login to view URL]; i<L; i++) { if (m=[login to view URL](f[i].re)) { v=f[i].f(m); if (typeof(v)!="undefined") { return v; } } } return 9999999999999; // So non-parsed dates will be last, not first }; return sort; })();
ID del proyecto: 499613

Información sobre el proyecto

3 propuestas
Proyecto remoto
Activo hace 15 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
Please check PM for detail.
$30 USD en 0 día
4,9 (9 comentarios)
3,6
3,6
3 freelancers están ofertando un promedio de $43 USD por este trabajo
Avatar del usuario
I can do it easily...
$70 USD en 1 día
5,0 (18 comentarios)
4,3
4,3
Avatar del usuario
I can do this overnight or sooner.
$30 USD en 1 día
5,0 (4 comentarios)
3,8
3,8

Sobre este cliente

Bandera de UNITED STATES
Dallas, United States
5,0
17
Forma de pago verificada
Miembro desde nov 2, 2007

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.