Home > sncf.js > DisruptionManager > search
DisruptionManager.search() method
Search the disruptions
Signature:
typescript
search(since_date?: Date, until_date?: Date): Promise<Disruption[]>;
Parameters
Parameter | Type | Description |
---|---|---|
since_date | Date | (Optional) Defines the start date of the disruptions to search for |
until_date | Date | (Optional) Defines the end date of the disruptions to search for |
Promise<Disruption[]>
Example
This example shows all the disruptions from yesterday to today
javascript
const {Client} = require('SNCF.js');
const client = new Client();
client.disruptions.search(new Date(Date.now() - 86400000), new Date())
.then(disruptions => {
console.log(disruptions)
})
.catch(console.error)