Skip to content

Instantly share code, notes, and snippets.

View 4drian-sanchez's full-sized avatar

Adrian Sanchez 4drian-sanchez

View GitHub Profile
export const dateFormatter = fecha => {
const nuevaFecha = new Date(fecha.split("T")[0].split("-"));
const opciones = {
weekday: "long",
year: "numeric",
month: "long",
day: "2-digit",
};
return nuevaFecha.toLocaleDateString("es-ES", opciones);
@4drian-sanchez
4drian-sanchez / css
Last active July 14, 2023 20:08
line limit with css only
.line-limit {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
@4drian-sanchez
4drian-sanchez / js
Created May 10, 2023 01:00
Formatear numeros a dolares
const formatearPresupuesto = (cantidad = '') => {
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
return formatter.format(cantidad)
}
@4drian-sanchez
4drian-sanchez / js
Last active May 11, 2023 00:42
useForm
import { useState } from "react";
export const useForm = (initialForm = {}) => {
const [ formState, setFormState ] = useState( initialForm );
const hundleChange = ({ target: { name, value } }) => {
setFormState({
...formState,
[ name ]: value
<picture>
<source sizes="1920w, 1280w, 640w"
srcset=
"img/imagen.avif 1920w,
img/imagen-1280.avif 1280w,
img/imagen-640.avif 640w"
type="image/avif">
<source
sizes="1920w, 1280w, 640w"
srcset="img/imagen.webp 1920w,
@4drian-sanchez
4drian-sanchez / js
Last active July 28, 2023 23:57
Expresion regular para validar correos electronicos
const regex = new RegExp("([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\"\(\[\]!#-[^-~ \t]|(\\[\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\[[\t -Z^-~]*])");