javascript - Return individual days opening hours from foursquare venue endpoint -
the foursquare api returns following, located @ data.response.venue.hours, venue opening hours at:
hours: { status: "closed until noon", isopen: false timeframes: [ { days: "mon–wed", open: [ { renderedtime: "noon–11:00 pm" } ], segments: [ ] }, { days: "thu", includestoday: true, open: [ { renderedtime: "noon–midnight" } ] segments: [ ] }, { days: "fri–sat", open: [ { renderedtime: "11:00 am–1:00 am" } ] segments: [ ] }, { days: "sun", open: [ { renderedtime: "noon–10:30 pm" } ] segments: [ ] }, ] }
the group of days varies venue venue, i.e. might have mon-tue, wed-sat, sun or variation instead of above.
i'm looking sort information can return opening hours individual days, i.e. call monday on it's own. javascript knowledge isn't great start good.
thanks help.
for getting venue hours, can use venues/venue_id/hours endpoint, has more machine-friendly result
hours: { timeframes: [ { days: [ 1 2 3 4 5 6 7 ], includestoday: true, open: [ { start: "0600", end: "2000" } ], segments: [ ] } ] }
this simplified case 7 days have same open segment, in other cases should able iterate through timeframes , each day's open array.
var mon; if (timeframes[j].days.indexof(i) != -1) { mon = timeframes[j].open; }
Comments
Post a Comment