List of published post dates only outputting one date

you are overwriting the $testlist variable in each iteration of the loop. You need to concatenate each date to $testlist instead.

please try to fetch all posts from the past year and create a js array containing their dates and make sure to call the test() function where you want this script to be executed

function test() {
    $args = array(
        'posts_per_page' => -1,
        'post_type'      => 'post',
        'post_status'    => 'publish',
        'date_query'     => array(
            'after' => '1 year ago',
        ),
    );
    $posts = get_posts( $args );
    $testlist=""; // Initialize the variable
    foreach ( $posts as $post ) {
        $testlist .= '{date: "' . get_the_date( 'Y-n-j', $post ) . '", value: "1"},'; // Concatenate dates
    }
    echo '
    <script>
    jQuery(document).ready(function($) {
        var massive = [
            ' . $testlist . '
        ];
    });
    </script>';
}

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino