import Tooltip from "@material-ui/core/Tooltip"; import moment from "moment-timezone"; import React from "react"; import useDateLocalize from "@saleor/hooks/useDateLocalize"; import { LocaleConsumer } from "../Locale"; import { Consumer } from "./DateContext"; interface DateProps { date: string; plain?: boolean; } export const Date: React.FC = ({ date, plain }) => { const localizeDate = useDateLocalize(); const getHumanized = (value: string, locale: string, currentDate: number) => moment(value) .locale(locale) .from(currentDate); return ( {locale => ( {currentDate => plain ? ( localizeDate(date) ) : ( ) } )} ); }; Date.displayName = "Date"; export default Date;