Git Product home page Git Product logo

hours-formatter's Introduction

Turn this:

[
  {
    name: "Bob's shop",
    hours: "Mon-Thu, Sun 11:30 am - 9:30 pm / Fri-Sat 11:30 am - 10 pm"
  },
  {
    name: "Karen's shop",
    hours: "Mon - Tues 4:30 pm - 11:15 pm / Weds - Thurs 10:15 am - 5 pm / Fri 5:15 am - 8:30 pm / Sat - Sun 10 am - 2:30 am"
  }
];

Into this:

[
  {
    "name": "Bob's shop",
    "hours": [
      {
        "day": "Sunday",
        "from": "11:30 AM",
        "to": "9:30 PM"
      },
      {
        "day": "Monday",
        "from": "11:30 AM",
        "to": "9:30 PM"
      },
      {
        "day": "Tuesday",
        "from": "11:30 AM",
        "to": "9:30 PM"
      },
      {
        "day": "Wednesday",
        "from": "11:30 AM",
        "to": "9:30 PM"
      },
      {
        "day": "Thursday",
        "from": "11:30 AM",
        "to": "9:30 PM"
      },
      {
        "day": "Friday",
        "from": "11:30 AM",
        "to": "10:00 PM"
      },
      {
        "day": "Saturday",
        "from": "11:30 AM",
        "to": "10:00 PM"
      }
    ]
  },
  {
    "name": "Karen's shop",
    "hours": [
      {
        "day": "Monday",
        "from": "4:30 PM",
        "to": "11:15 PM"
      },
      {
        "day": "Tuesday",
        "from": "4:30 PM",
        "to": "11:15 PM"
      },
      {
        "day": "Wednesday",
        "from": "10:15 AM",
        "to": "5:00 PM"
      },
      {
        "day": "Thursday",
        "from": "10:15 AM",
        "to": "5:00 PM"
      },
      {
        "day": "Sunday",
        "from": "5:15 AM",
        "to": "8:30 PM"
      },
      {
        "day": "Saturday",
        "from": "5:15 AM",
        "to": "8:30 PM"
      }
    ]
  }
]

hours-formatter's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.