Skip to main content

Moroccan Time API

APICalendarHono

Overview

A powerful API that provides accurate date conversions between Gregorian, Islamic (Hijri), and Amazigh (Berber) calendars — all with support for Tifinagh script.

Built with Hono and Bun for edge performance, deployed seamlessly to Vercel.

Features

  • Real-time Date Conversion — Convert any date between three calendar systems
  • Islamic/Hijri Dates — Powered by the Aladhan API for accurate Hijri dates
  • Amazigh Calendar — Julian-based calendar with Tifinagh script support
  • Morocco Timezone — All dates calculated for Africa/Casablanca timezone
  • Edge Ready — Deploys seamlessly to Vercel

API Endpoints

Current Date

EndpointDescription
GET /api/date/All three calendars for today
GET /api/amazigh/Today’s Amazigh date
GET /api/gregorian/Today’s Gregorian date
GET /api/islamic/Today’s Islamic date
GET /api/time/Current Morocco time

Date Conversion

EndpointDescription
GET /api/amazigh/{year}/{month}/{day}/Convert Gregorian to Amazigh
GET /api/gregorian/{year}/{month}/{day}/Validate/format Gregorian date
GET /api/islamic/{year}/{month}/{day}/Convert Gregorian to Islamic

Month Names

EndpointDescription
GET /api/amazighMonths/Amazigh months with Tifinagh
GET /api/gregorianMonths/Gregorian months with Tifinagh
GET /api/islamicMonths/Islamic months with Tifinagh

Calendar Information

  • Gregorian — Standard civil calendar
  • Islamic (Hijri) — Lunar calendar, dates from Aladhan API
  • Amazigh (Berber) — Julian-based: Amazigh year = Julian year + 950 CE, New Year on Yennayer 1 (January 14), 12 months with Berber names in Latin, Arabic, and Tifinagh

Tech Stack

TechnologyPurpose
TypeScriptType-safe JavaScript
HonoLightweight web framework
BunFast JavaScript runtime
VercelEdge deployment platform
Aladhan APIIslamic date calculations

Project Structure

src/
├── index.ts              # Main API routes
├── amazighDate.ts        # Amazigh calendar conversion
├── amazighCalendar.ts    # Amazigh month names
├── gregorianDate.ts      # Gregorian date utilities
├── gregorianCalendar.ts  # Gregorian month names
├── islamicDate.ts        # Islamic date API integration
└── islamicCalendar.ts    # Islamic month names

Quick Start

git clone https://github.com/phaylali/moroccan-time-api.git
cd moroccan-time-api
bun install
bun run dev

Server starts at http://localhost:3000. No environment variables required.