Day.js doesn't have the duration function built-in as Moment.js does. However, there is a plugin for Day.js named duration which you can use.
Here's how you can use the plugin:
First, you need to install the plugin:
npm install dayjs duration
Then, in your code, you need to import and extend Day.js with it:
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)
// Now you can use dayjs.duration
const diff = dayjs.duration(dayjs().diff(dayjs(timeString)));
Remember, the duration plugin should be loaded whenever you want to use the duration function.
Also, be aware that when working with durations in Day.js, the API is slightly different from Moment.js. For example, to get the duration in minutes, you would use diff.asMinutes(), not diff.minutes().