It is library for simple work with 2gis schedule. You can get information is organisation work now? When it will open?
There is no build, only lodash in dependency and ECMAScrip 5.1 was used for develop
Things that need to understand for using library
Looks like this
{
Mon: {
working_hours: [
{ from: '08:00', to: '13:00' },
{ from: '14:00', to: '17:15' }
]
},
Tue: {
working_hours: [
{ from: '08:00', to: '13:00' },
{ from: '14:00', to: '17:15' }
]
},
Wed: {
working_hours: [
{ from: '08:00', to: '17:00' }
]
},
Fri: {
working_hours: [
{ from: '08:00', to: '17:00' }
]
},
Sat: {
working_hours: [
{ from: '10:00', to: '14:00' }
]
}
}
It means that organisation works:
- on Monday and Tuesday from 8:00 to 17:15 with brake from 13:00 to 14:00
- on Wednesday and Friday from 8:00 to 17:00
- on Sunday from 10%00 to 14:00
- on Thursday and Saturday don't works
Way to represent time in which we understand, is this organisation works, or not
{
day: 'Mon',
time: '12:30'
}
In this way we say that we want to know, if organisation works on Monday at 12:30
There is constant DAY_KEYS
exported by library to convert javascript Date.getDay()
to correct day.
schedule
- 2gis schedule objecttoday
- object with day description
Boolean
is organisation open now?
schedule
- 2gis schedule object
Boolean
is organisation works without breaks?
schedule
- 2gis schedule object
Boolean
is organisation have the same schedule for all days?
schedule
- 2gis schedule objectnow
- now time moment
Object
- organisation schedule for today
{
type: WORK_EVERYDAY,
intervals: { from: '14:00', to: '17:00' }
}
Today organisation works from 14:00 to 17:00, in the same days worktime the same
Returns array of breaks between work time intervals
If work time is: [{ from: '08:00', to: '13:00' }, { from: '14:00', to: '17:45' }, { from: '18:00', to: '20:00' }]
Breaks will be [{ from: '13:00', to: '14:00' }, { from: '17:45', to: '18:00' }]
schedule
- 2gis schedule objectnow
- now time moment
Array
- array of organisation breaks for today
State of the schedule with forecast like this: "Will open tomorrow at 10:00" / "Will open on Monday at 8:00" but in object with constants instead of text
schedule
- 2gis schedule objectnow
- now time momentforecastThreshold
- how max minutes should left when we should say about next event (open / close)weekends
- days that usually is day off['Sat', 'Sun']
Object
- Information about schedule
{
type: 'Current status.',
minutesTo: 'Minutes before next event. Opening or closing.',
time: 'Time when next event will happened',
day: 'Day name in what next event will happen if it's not today,
breakType: 'Type of brake. Lunch or other brake.'
}
OPENED
- firm opened, will not close in near time.
WILL_CLOSE_IN_TIME_FOR_BREAK
- will close in next minutesTo
for break breakType
.
WILL_CLOSE_IN_TIME
- will close in next minutesTo
WILL_OPEN_AT_TIME
- will open today at time
WILL_OPEN_TOMORROW_AT_TIME
- will open tomorrow at time
WILL_OPEN_DAY_AFTER_TOMORROW_AT_TIME
- will open the day after tomorrow at time
WILL_OPEN_AT_DAY_AT_TIME
- will open on day
at time
WILL_OPEN_IN_TIME
- will open in next minutesTo
WILL_OPEN_IN_TIME_FROM_BREAK
- will open in minutesTo
from brake breakType
WILL_OPEN_AT_TIME_FROM_BREAK
- will open at time
from brake breakType