Skip to content

Commit 70eee2f

Browse files
committed
use same date retrieval for tracking and analysis (#227)
We use "WP timestamp" in combination with strftime in the tracking routine and retrieve WP Time in "Y-m-d" format for retrieval in the dashboard logic. While it is discouraged to work with "WP Timestamps" and strftime is deprecated as of PHP 8.1, is makes sense to use the same source of time on both ends. The present logic is not inherently wrong. The "WP timestmap" is basically a unix timestamp with zone offeset already calculated and parsing the result yields a local time value shifted to GMT. Zone is not part of the output here, so it's effectively the same as Y-m-d local date. We not use the current time in Y-m-d notation on both ends without breaking or invalidating the present logic.
1 parent 6a71cf0 commit 70eee2f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
33

4+
## unreleased
5+
* Use same date retrieval for tracking and analysis (#227) (#232)
6+
47
## 1.8.3
58
* Update documentation links (#204)
69
* Minor markup fix on settings page (#206)

inc/class-statify-frontend.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static function track_visit( $is_snippet = false ) {
8282
);
8383

8484
// Set request timestamp.
85-
$data['created'] = strftime( '%Y-%m-%d', current_time( 'timestamp' ) );
85+
$data['created'] = current_time( 'Y-m-d' );
8686

8787
$needles = array( home_url(), network_admin_url() );
8888

0 commit comments

Comments
 (0)