Skip to content

Commit

Permalink
agrego funcion local de obtener la fecha
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignaherrero committed Apr 30, 2022
1 parent 395a59a commit bc6d3a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 8 additions & 0 deletions helper/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import moment from "moment";
import "moment/locale/es";

export const getDateDayMonthYear = (published) => {
moment.locale("es");
const result = moment(published).format("LL");
return result;
};
7 changes: 3 additions & 4 deletions pages/posts/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from "react";
import parse from "html-react-parser";
import moment from "moment";
import Image from "next/image";
import { getDateDayMonthYear } from "../../helper/data";

export default function Posts({ post }) {
return (
Expand Down Expand Up @@ -46,12 +47,10 @@ export default function Posts({ post }) {
width="32px"
height="32px"
/>
<div>
<div className="ml-2">
<span>
{" "}
Published {moment(post.published).format(
"llll"
)} by{" "}
Publicado {getDateDayMonthYear(post.published)} by{" "}
</span>
<a href="#!" className="font-medium">
{post.author.name}
Expand Down

1 comment on commit bc6d3a7

@vercel
Copy link

@vercel vercel bot commented on bc6d3a7 Apr 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

challenge-atomik – ./

challenge-atomik.vercel.app
challenge-atomik-git-main-nacho93.vercel.app
challenge-atomik-nacho93.vercel.app

Please sign in to comment.