
* 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
14 lines
404 B
TypeScript
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;
|