# Opening Hours to JSON - Normalize Google Maps Business Hours (`that_red_bird/opening-hours-normalizer`) Actor

Google Maps and Yelp give you hours as messy text. Pick the scraper's dataset and get weekly JSON, schema.org openingHoursSpecification and an open-now flag per place, with 24/7, closed and split-shift handling and day names in many languages. No re-scraping.

- **URL**: https://apify.com/that_red_bird/opening-hours-normalizer.md
- **Developed by:** [mohamed alaya](https://apify.com/that_red_bird) (community)
- **Categories:** Lead generation, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 place normalizeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Opening Hours to JSON - Normalize Google Maps Business Hours

Turns the messy opening-hours text from Google Maps, Yelp and other place scrapers into clean weekly JSON, schema.org `openingHoursSpecification` and an "open now" flag.
Built for people who already scraped thousands of places and now have to make sense of "Mon-Fri 9 AM to 5 PM, Sat 10-2" in ten different formats.

### Quick start: use it after a Google Maps scraper

1. Run your Google Maps scraper (Compass, Lukas Krivka or any other).
2. Start this Actor, pick that run's dataset in **Google Maps / places dataset(s)**.
3. Download the output as JSON, CSV or Excel.

Run it with empty input to see a demo of 8 places in English, French, German and Spanish.

### Input examples

**1. Dataset from a Google Maps scraper**

```json
{ "datasets": ["<pick with the dataset picker>"] }
```

**2. Pasted rows, with coordinates for the time zone**

```json
{
  "rows": [
    { "title": "Joe's Pizza", "openingHours": "Mon-Fri 9:00-17:00; Sat 10:00-14:00; Sun closed", "location": { "lat": 40.73, "lng": -74.0 } }
  ]
}
```

**3. Plain hours strings, one fixed time zone, test a specific moment**

```json
{
  "rows": ["lundi au vendredi 9h-18h, samedi 10h-13h", "Open 24 hours"],
  "defaultTimezone": "Europe/Paris",
  "checkAt": "2026-12-24T18:30:00+01:00"
}
```

### Input guide

| Field | What it does |
|---|---|
| `datasets` | Pick one or more datasets (the picker gives the Actor read permission). |
| `rows` / `rowsCsv` | Paste JSON rows, a JSON array or a CSV with a header row. |
| `hoursField` | Name of the column holding the hours. Empty = auto-detect `openingHours`, `opening_hours`, `hours`, `businessHours`, `workingHours` and similar. |
| `defaultTimezone` | IANA zone (e.g. `Europe/Paris`) used when a row has no coordinates or time zone. |
| `checkAt` | ISO date-time to test open/closed at, in each place's own time zone. Empty = now. |
| `keepAllFields` | Copy every original column to the output (default on). |
| `maxRows` | Safety limit per run. |

### What it understands

- Google Maps `openingHours` arrays (`{day, hours}`), plain text blocks, compact text such as `Mo-Fr 09:00-17:00; Sa 10:00-14:00` (OSM-style short day names), Yelp `open` arrays (`start`/`end`/`day`), and objects keyed by day name.
- 12-hour and 24-hour times, `9-5`, `9h30`, `09.00`, `9:00 Uhr`, narrow no-break spaces and en-dashes from Google.
- Split shifts, overnight hours (`10 AM to 4 AM`), `Open 24 hours`, `24/7`, `Closed`, "permanently/temporarily closed".
- Day names in English, French, German, Spanish, Italian, Portuguese, Dutch, Swedish, Danish/Norwegian, Polish, Turkish, Indonesian, Russian, Arabic, Chinese and Japanese, plus "weekdays", "weekends", "daily".

### Output

One row per input row. Your original fields are kept and these are added:

| Field | Meaning |
|---|---|
| `hoursStatus` | `parsed`, `partial` (some lines not understood), `unparsed` or `no-hours-field`. |
| `openingHoursText` | Compact text, e.g. `Mo-Fr 09:00-17:00; Sa 10:00-14:00; Su off`. |
| `hoursWeekly` | `{monday:[{open:"09:00",close:"17:00"}], ...}`. An empty list means closed. `close:"24:00"` = midnight, `overnight:true` = ends the next day. |
| `hours_mon` ... `hours_sun` | One flat text column per day, handy for CSV/Excel. |
| `openingHoursSpecification` | schema.org array, ready for JSON-LD. |
| `is24x7`, `weeklyOpenHours` | 24/7 flag and total open hours per week. |
| `timezone`, `timezoneSource` | IANA zone from a field, from coordinates, or your fallback. |
| `isOpenNow`, `openStatus` | Open now at `checkAt` (or now), e.g. `Open until 17:00` or `Closed, opens Tue 09:00`. `null` if the time zone is unknown. |
| `assumedClosedDays` | Days that were not mentioned in the text and are treated as closed. |
| `unparsedLines` | Lines the parser could not read, so you can review them. |

Sample row (shortened):

```json
{ "title": "Boulangerie Paul", "hoursStatus": "parsed", "openingHoursText": "Mo-Fr 07:00-20:00; Sa 08:00-19:00; Su off", "timezone": "Europe/Paris", "timezoneSource": "coordinates", "isOpenNow": false, "openStatus": "Closed, opens Mon 07:00", "weeklyOpenHours": 91 }
```

### Use it with

Google Maps scraper -> **this Actor** -> your CRM, delivery app or local-SEO tool. It pairs naturally with the Google Maps Emails Actor from the same author: enrich the contacts, normalize the hours.

### FAQ

**Does it call any website or API?** No. Parsing and time zone lookup are offline; the only read is your own dataset.

**Why is `isOpenNow` null?** The row had no coordinates or time zone field and you set no fallback time zone.

**Is it OSM `opening_hours` syntax?** It reads the common short form (`Mo-Fr 09:00-17:00`) but not the full OSM grammar (public holidays, week numbers, months).

### Honest limits

- Text it cannot read ("Call for hours", seasonal rules, holiday exceptions) is reported in `unparsedLines`, never guessed. Holiday and special-day hours are not modelled.
- Bare `9-5` is read as 09:00-17:00; ambiguous short forms in other languages may be wrong, check `hoursStatus` and the sample before bulk use.
- Time zones come from coordinates (offline lookup near borders can be off).

### Price

Pay per event: **$0.0005 per place normalized** (only rows where hours were found and delivered; unreadable or hour-less rows are free). 1,000 places = $0.50, 50,000 places = $25.

# Actor input Schema

## `datasets` (type: `array`):

Pick the dataset of any Google Maps, Yelp or other places scraper run. Use the picker rather than typing an ID: it gives this Actor permission to read your dataset. Leave empty to use the pasted rows below, or the built-in demo list.

## `rows` (type: `array`):

Optional. Paste rows as JSON objects, e.g. {"title":"Joe's Pizza","openingHours":"Mon-Fri 9am-5pm","location":{"lat":40.73,"lng":-74.0}}. Plain strings are treated as an hours text. Extra fields are kept in the output.

## `rowsCsv` (type: `string`):

Optional. Paste a CSV (first row = column names) or a JSON array. One of the columns should hold the hours text, for example openingHours or hours.

## `hoursField` (type: `string`):

Name of the field that holds the hours. Leave empty to auto-detect (openingHours, opening_hours, hours, businessHours, workingHours and similar).

## `defaultTimezone` (type: `string`):

IANA time zone used for open-now when a row has no coordinates or time zone field, for example Europe/Paris or America/Chicago. Rows with coordinates get their own time zone automatically. Leave empty to skip open-now for such rows.

## `checkAt` (type: `string`):

Optional ISO date-time (for example 2026-12-24T18:30:00Z) to test whether each place is open at that moment, in the place's own time zone. Leave empty for the current time.

## `keepAllFields` (type: `boolean`):

When on, every field of the input row is copied to the output next to the normalized hours. Turn off to keep only title, address, ids, website, phone, category and location.

## `maxRows` (type: `integer`):

Safety limit on the number of rows processed in one run.

## Actor input object example

```json
{
  "rows": [],
  "rowsCsv": "",
  "hoursField": "",
  "defaultTimezone": "",
  "checkAt": "",
  "keepAllFields": true,
  "maxRows": 50000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `downloadCsv` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `count` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "rows": [],
    "rowsCsv": "",
    "hoursField": "",
    "defaultTimezone": "",
    "checkAt": "",
    "maxRows": 50000
};

// Run the Actor and wait for it to finish
const run = await client.actor("that_red_bird/opening-hours-normalizer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "rows": [],
    "rowsCsv": "",
    "hoursField": "",
    "defaultTimezone": "",
    "checkAt": "",
    "maxRows": 50000,
}

# Run the Actor and wait for it to finish
run = client.actor("that_red_bird/opening-hours-normalizer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "rows": [],
  "rowsCsv": "",
  "hoursField": "",
  "defaultTimezone": "",
  "checkAt": "",
  "maxRows": 50000
}' |
apify call that_red_bird/opening-hours-normalizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,that_red_bird/opening-hours-normalizer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/tE3w5pyLQepEpB9Me/builds/bTevt4924rY6dHz5D/openapi.json
