Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/js/components/email-reporting/FrequencySelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function FrequencySelector( { isUserSubscribed, isLoading } ) {
},
monthly: {
label: __( 'Monthly', 'google-site-kit' ),
period: __( 'Last 28 days', 'google-site-kit' ),
period: __( 'Last month', 'google-site-kit' ),
description: __(
'Sent on the 1st of each month',
'google-site-kit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exports[`FrequencySelector Story states (visual + DOM) Monthly selected renders
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down Expand Up @@ -210,7 +210,7 @@ exports[`FrequencySelector Story states (visual + DOM) Previously saved frequenc
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down Expand Up @@ -345,7 +345,7 @@ exports[`FrequencySelector Story states (visual + DOM) Previously saved frequenc
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down Expand Up @@ -480,7 +480,7 @@ exports[`FrequencySelector Story states (visual + DOM) Quarterly selected render
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down Expand Up @@ -615,7 +615,7 @@ exports[`FrequencySelector Story states (visual + DOM) Weekly selected (default
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down Expand Up @@ -750,7 +750,7 @@ exports[`FrequencySelector Story states (visual + DOM) Weekly selected with Sund
<span
class="googlesitekit-typography googlesitekit-typography--body googlesitekit-typography--small"
>
Last 28 days
Last month
</span>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion includes/Core/Email_Reporting/Initiator_Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static function build_reference_dates( $frequency, $timestamp ) {

$period_lengths = array(
Email_Reporting_Settings::FREQUENCY_WEEKLY => 7,
Email_Reporting_Settings::FREQUENCY_MONTHLY => 30,
Email_Reporting_Settings::FREQUENCY_MONTHLY => (int) $send_date->format( 't' ),
Email_Reporting_Settings::FREQUENCY_QUARTERLY => 90,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ public function test_handle_callback_action_without_subscribers_still_schedules_
/**
* @dataProvider data_build_reference_dates_uses_expected_period_length
*/
public function test_build_reference_dates_uses_expected_period_length( $frequency, $expected_days ) {
public function test_build_reference_dates_uses_expected_period_length( $frequency, $expected_days, $timestamp_string ) {
$original_timezone_string = get_option( 'timezone_string' );
$original_gmt_offset = get_option( 'gmt_offset' );

update_option( 'timezone_string', 'UTC' );
update_option( 'gmt_offset', 0 );

try {
$timestamp = strtotime( '2026-03-16 00:00:00 UTC' );
$timestamp = strtotime( $timestamp_string );

$reference_dates = Initiator_Task::build_reference_dates(
$frequency,
Expand Down Expand Up @@ -256,9 +256,12 @@ public function test_build_reference_dates_uses_previous_day_as_send_date() {

public function data_build_reference_dates_uses_expected_period_length() {
return array(
'weekly' => array( Email_Reporting_Settings::FREQUENCY_WEEKLY, 7 ),
'monthly' => array( Email_Reporting_Settings::FREQUENCY_MONTHLY, 30 ),
'quarterly' => array( Email_Reporting_Settings::FREQUENCY_QUARTERLY, 90 ),
'weekly' => array( Email_Reporting_Settings::FREQUENCY_WEEKLY, 7, '2026-03-16 00:00:00 UTC' ),
'monthly_31_day_month' => array( Email_Reporting_Settings::FREQUENCY_MONTHLY, 31, '2026-04-01 00:00:00 UTC' ),
'monthly_30_day_month' => array( Email_Reporting_Settings::FREQUENCY_MONTHLY, 30, '2026-07-01 00:00:00 UTC' ),
'monthly_28_day_month' => array( Email_Reporting_Settings::FREQUENCY_MONTHLY, 28, '2026-03-01 00:00:00 UTC' ),
'monthly_29_day_leap' => array( Email_Reporting_Settings::FREQUENCY_MONTHLY, 29, '2028-03-01 00:00:00 UTC' ),
'quarterly' => array( Email_Reporting_Settings::FREQUENCY_QUARTERLY, 90, '2026-03-16 00:00:00 UTC' ),
);
}
}