Comments (5)
@eniad do you have any idea how to fix this issue? I had a crack at it but I am not able to select the local timezone based upon the machine timezone settings.
from sitepod.
Hi @lewismc,
Sorry for the say in, but I would mention that, there are two solution to avoid this warning.
- In the php.ini you can set the default timezone. link
- In the php code you can set the actual timezone. link
I think you can set both of them if it is needed. The ini means the default fallback, but it is good when you can see the actual value in the code.
from sitepod.
Hi @sigee I appreciate you chiming in. Did you see the pull request I submitted? If you could scope it out and provide input it would be appreciated. Thank you
from sitepod.
Here is the PR https://github.com/nasa/sitepod/pull/10/files, I think it needs to be changed to be adaptive rather than restricted to UTC.
from sitepod.
@lewismc,
Unfortunatelly there is no way in standard php to get the user's timezone.
You can get the user's IP address and use a geoip api to get the location and timezone data.
Eg.: http://smart-ip.net/geoip-api
$ip = $_SERVER['REMOTE_ADDR']; // means we got user's IP address
$json = file_get_contents( 'http://smart-ip.net/geoip-json/' . $ip);
// maybe it's good to add some checks (if/else you've got an answer and if json could be decoded, etc.)
$ipData = json_decode( $json, true);
if ($ipData['timezone']) {
$timeZone = new DateTimeZone( $ipData['timezone']);
date_default_timezone_set($timeZone->getName())
}
else {
//not needed when php.ini is set.
date_default_timezone_set('UTC');
}
The UTC should be set in the php.ini as I mentioned before.
from sitepod.
Related Issues (20)
- Add travis-ci build to Sitepod
- Fix timezone warning upon successful Sitemap creation and save
- Sitemap successfuly created and saved links are broken on localhost HOT 1
- Deprecate generation of .txt sitemaps in favor of sitemap.xml
- Add functionality to ping BING
- Add sonarqube analysis
- Fix licensing headers
- Use fatfree templates HOT 1
- Fix encoding warning upon index.php form submit HOT 1
- timeformat error when using Short Format
- Add Help Wanted issues to Code.gov HOT 4
- Call to undefined function split() HOT 6
- FreeGeoIP API has been deprecated and moved to ipstack.com HOT 3
- Consider using IP2Location.io API as a failover HOT 1
- Get Sitepod on to Packagist HOT 1
- Add Badge Poser badges
- Implement a PHP Framework for Sitepod
- Adapting Sitepod to Accomodate Dynamicaly-generated Content
- Authentication/Proxy Configuration for Sitepod
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sitepod.