saleor-dashboard/src/hooks/useDateLocalize.ts
AlicjaSzu eba4ba2edf
update VisibilityCard component (#679)
* update VisibilityCard component

* add visibleInListings in Product

* update mutations and types with visibleInListings

* update ProductExportDialogInfo with availableForPurchase

* update defaultMessages

* update useDateLocalize hook

* update cypress tests

* update orders with availability info

* revert cypress changes

* update changelog

* update product update handlers

* fix VisibilityCard styles

* create AvailabilityCard component

* update defaultMessages

* update snapshots and messages

* fix ProductCreatePage form data types

* update defaultMessages
2020-09-03 12:25:16 +02:00

14 lines
404 B
TypeScript

import { LocaleContext } from "@saleor/components/Locale";
import moment from "moment-timezone";
import { useContext } from "react";
function useDateLocalize(): (date: string, format?: string) => string {
const { locale } = useContext(LocaleContext);
return (date: string, format?: string) =>
moment(date)
.locale(locale)
.format(format || "ll");
}
export default useDateLocalize;