Product Editor: Show correct Publish/Schedule button label when timezone is behind UTC (UTC-1, UTC-4, UTC-9, etc.) (#45848)
* Use useProductScheduled to determine button label * Changelog
This commit is contained in:
parent
5352c705b5
commit
37e58a982a
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Product Editor: Show correct Publish/Schedule button label.
|
|
@ -4,7 +4,6 @@
|
|||
import { MouseEvent } from 'react';
|
||||
import { Button } from '@wordpress/components';
|
||||
import { useEntityProp } from '@wordpress/core-data';
|
||||
import { isInTheFuture } from '@wordpress/date';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import type { Product } from '@woocommerce/data';
|
||||
|
||||
|
@ -12,6 +11,7 @@ import type { Product } from '@woocommerce/data';
|
|||
* Internal dependencies
|
||||
*/
|
||||
import { useProductManager } from '../../../../hooks/use-product-manager';
|
||||
import { useProductScheduled } from '../../../../hooks/use-product-scheduled';
|
||||
import type { WPError } from '../../../../utils/get-product-error-message';
|
||||
import type { PublishButtonProps } from '../../publish-button';
|
||||
|
||||
|
@ -35,11 +35,7 @@ export function usePublish< T = Product >( {
|
|||
'status'
|
||||
);
|
||||
|
||||
const [ editedDate ] = useEntityProp< string >(
|
||||
'postType',
|
||||
productType,
|
||||
'date_created_gmt'
|
||||
);
|
||||
const { isScheduled } = useProductScheduled( productType );
|
||||
|
||||
const isBusy = isPublishing || isValidating;
|
||||
const isDisabled =
|
||||
|
@ -61,7 +57,7 @@ export function usePublish< T = Product >( {
|
|||
function getButtonText() {
|
||||
if (
|
||||
window.wcAdminFeatures[ 'product-pre-publish-modal' ] &&
|
||||
isInTheFuture( editedDate )
|
||||
isScheduled
|
||||
) {
|
||||
return __( 'Schedule', 'woocommerce' );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue