Skip to content

Edembf/Project-9-TimeZone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Planet Pulse — Time & Weather 🌍⏰

A small Expo + React Native app that shows live local times for several cities and pulls current temperature from OpenWeatherMap. Designed for quick viewing of global time + weather in a circular, card-style UI.


▶️ Features

  • Live clock (updates every second)
  • Current temperature (Celsius) for each city via OpenWeatherMap
  • Clean circular UI with background image
  • Built with Expo + React Native

Cities shown by default: Kolkata, Paris, New York, London, Tokyo, Sydney.


🛠️ Tech stack

  • React Native (Expo)
  • OpenWeatherMap API
  • Main component: TimeZoneStatus.js

📥 Prerequisites

  • Node.js (14+ recommended)
  • npm or yarn
  • Expo CLI (optional; npm start uses the local expo package)
  • Android emulator or a physical device with Expo Go

🚀 Run the app (development)

  1. Install dependencies
cd TimeZone
npm install
  1. Start Expo
npm start
# or run on Android emulator/device
npm run android
  1. Open in Expo Go (scan QR) or use an emulator.

Note: npm run ios works on macOS only.


🔑 OpenWeatherMap API key

The app fetches temperatures from OpenWeatherMap. You MUST provide your API key before the weather requests will succeed.

Two ways to add your key:

  1. Quick (edit file)
  • Open TimeZoneStatus.js and replace the apiKey value with your key.
// inside TimeZoneStatus.js
const apiKey = 'YOUR_OPENWEATHERMAP_API_KEY';
  1. Recommended (don’t commit keys)
  • Use environment/config solutions (e.g. app.json extra + expo-constants, react-native-dotenv, or EAS secrets) and read the key at runtime.

⚠️ Important: Do not commit your API key. Add any local .env files to .gitignore.


🔧 How it works (short)

  • Times are produced with new Date().toLocaleString(..., { timeZone }) and updated every second with setInterval.
  • Weather is fetched from OpenWeatherMap's /weather?q=<city> endpoint and displayed in °C.

Files to look at:

  • TimeZoneStatus.js — UI + logic for times and weather
  • App.js — app entry (renders TimeZoneStatus)

✨ Customization

  • Change shown cities: edit the cities array in TimeZoneStatus.js.
  • Switch units (°C → °F): modify the units query param in the fetch URL.
  • Replace background image or adjust styles in the styles object.

⚠️ Troubleshooting

  • Weather shows N/A → check your OpenWeatherMap API key and network connectivity.
  • App won't start → run npm install and npm start -- --clear to clear Metro cache.
  • Android device not detected → ensure emulator is running or the physical device is connected (use adb devices).

💡 Next improvements (ideas)

  • Move API key into secure env/config
  • Add selectable cities and persistent settings
  • Add a forecast card (3-day / hourly)
  • Improve error UI for failed API calls

🤝 Contributing

Feel free to open issues or PRs. Keep changes focused and add tests or screenshots when possible.


📜 License

MIT — see LICENSE (or add one if you need a specific license).


If you'd like, I can (optionally) replace the hard-coded API key with a secure app.json/.env-based approach — tell me which method you prefer and I will implement it. ✨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •