microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6b8cdbb830ed7d91525cc76810df5458772836e7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

lib/codepush-node-sdk/src/utils/date-utils.ts

12lines · modecode

1import { differenceInMinutes, format } from 'date-fns';
2
3export function formatDate(unixOffset: number): string {
4 let formattedDateString: string;
5 const date = new Date(unixOffset);
6 if (differenceInMinutes(Date.now(), date) < 2) {
7 formattedDateString = 'Just now';
8 } else {
9 formattedDateString = format(date, 'MMM DD, hh:mm A');
10 }
11 return formattedDateString;
12}