#date

1 messages · Page 1 of 1 (latest)

keen spruce
#

what could be reason date-fns formats and dispalys "just now" although date is correct and formatted time difference is correct in dev but not in prod.

const formatComments = (props: string): Comment[] => {
const comments = JSON.parse(props);

return comments.map((props: any) => ({
id: props.id,
userId: props.userId,
author: formatAuthor(props),
postId: props.postId,
createdAt: new Date(props.createdAt),
formattedTimeDifference: formatTimeDifference(new Date(props.createdAt)),
content: props.content,
}));
};

echo parrotBOT
#

Hi @keen spruce. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, there are a few potential reasons why the date-fns library might be displaying "just now" in production even though the date is correct and the formatted time difference is correct in development.

  1. Environment Differences: There could be differences between your development and production environments that are causing this issue. For example, there could be differences in the system time, time zone, or locale settings between the two environments.

  2. Build Differences: There could be differences in how your code is being built for development versus production. For example, one of the knowledge sources mentions an issue where certain library functions with similar names have different behavior in development versus production builds (source (https://github.com/vercel/next.js/issues/56480)).

  3. Code Differences: There could be differences in the code that's being executed in development versus production. For example, one of the knowledge sources mentions an issue where a dynamic import with a path alias was not working (source (https://github.com/vercel/next.js/issues/63372)).

  4. Library Version Differences: There could be differences in the versions of the date-fns library (or other libraries) that are being used in development versus production. For example, one of the knowledge sources mentions an issue that was present in one version of Next.js but not in a later version (source (https://github.com/vercel/next.js/issues/52698)).

Without more specific information about your code and your environments, it's hard to say exactly what might be causing this issue. However, these are some potential areas you could investigate.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: