Effective Dating

There are some aspects of the Doshii API that are only valid during certain times of the day, or certain days in the year (e.g. location operating hours, menu pricing, item availability, etc). We have termed this logic, Effective Dating, and will use the below structure across the various API endpoints to define the dates and times that the entity comes into effect. 

The structure is broken up into a list of policies, each of those policies define a period of time.

Policy

- PolicyDate Object

Policy Properties

Example

- More Examples

 

Policy

All root-level properties are optional. An optional root-level property without a value is omitted.

[{
status: <String* (open|closed)>,
dates: [<PolicyDate>],
time: {
from: <String* (HH:mm)>,
to: <String* (HH:mm)>
},
daysOfWeek: [<String (mon|tue|wed|thu|fri|sat|sun)>],
effective: {
from: <String (yyyy-mm-dd)>,
to: <String (yyyy-mm-dd)>
}
}]

PolicyDate Object

[{
day: <Number (1-31)>,
month: <Number (1-12)>,
year: <Number>
}]

Policy Properties

 

Example

A restaurant could have the following trading hours:

 

Its full payload would be:

[{
    status: 'closed',
    daysOfWeek: ['mon']
}, {
    status: 'open',
    time: {
        from: '11:30',
        to: '14:30'
    },
    daysOfWeek: ['tue', 'wed', 'thu', 'fri', 'sat', 'sun']
}, {
    status: 'open',
    time: {
        from: '17:30',
        to: '21:00'
    },
    daysOfWeek: ['tue', 'wed', 'thu', 'sun']
}, {
    status: 'open',
    time: {
        from: '17:30',
        to: '21:30'
    },
    daysOfWeek: ['fri', 'sat']
}, {
    status: 'closed',
    dates: [{
        day: 1,
        month: 1
    }]
}, {
    status: 'closed',
    dates: [{
        day: 24,
        month: 12
    }, {
        day: 26,
        month: 12
    }]
}]

More Examples

Example 1: Opening times from Jan 1 next year

[{
    status: 'open',
    time: {
        from: '11:00',
        to: '19:00'
    },
    effective: {
        from: '2019-01-01'
    }
}]

Example 2: Closed every Monday

[{
    status: 'closed',
    daysOfWeek: ['mon']
}]

Example 3: Closed every Xmas Day

[{
    status: 'closed',
    dates: [{
        day: 25,
        month: 12
    }]
}]

Example 4: Closed for lunch everyday

[{
    status: 'closed',
    time: {
        from: '12:00',
        to: '13:00'
    }
}]

Example 5: Longer hours for week night trading

[[{
    status: 'open',
    time: {
        from: '11:00',
        to: '21:00'
    },
    daysOfWeek: ['mon', 'tue', 'wed', 'thu', 'fri']
}]

Example 6: Xmas

Open till midnight the day before xmas and closed for xmas.

[{
    status: 'open',
    dates: [{
        day: 23,
        month: 12
    }],
    time: {
        from: '11:00',
        to: '23:59'
    }
}, {
    status: 'closed',
    dates: [{
        day: 24,
        month: 12
    }]
}]