geoshell
Version:
A CLI to fetch real-time geo-data from your terminal
24 lines (21 loc) • 731 B
JavaScript
/**
* Timezone command implementation
*/
/**
* Get timezone information for a location
*
* @param {string} location - City name or coordinates
* @returns {Promise<Object>} Timezone information
*/
async function timezone(location) {
// Mock implementation - would use timezone API in real version
const now = new Date();
const offset = Math.floor(Math.random() * 24) - 12; // Random UTC offset between -12 and +12
return {
location: location,
timezone: `UTC${offset >= 0 ? '+' : ''}${offset}`,
current_time: new Date(now.getTime() + offset * 3600000).toISOString(),
offset: `${offset >= 0 ? '+' : ''}${String(offset).padStart(2, '0')}:00`
};
}
module.exports = timezone;