If I’m using Cursor to help me scaffold out a new app, it sometimes creates Laravel migration files with the filename xxxx_xx_xx-migration-description
, which is annoying, to say the least.
This is because it doesn’t know the current date or time, so as a quick hack until – I assume – they add it as a feature, I’m using a free API that returns a JSON representation of the current date and time.
Here is Europe/London:
{
"utc_offset": "+01:00",
"timezone": "Europe/London",
"day_of_week": 3,
"day_of_year": 283,
"datetime": "2024-10-09T13:01:33.793864+01:00",
"utc_datetime": "2024-10-09T12:01:33.793864+00:00",
"unixtime": 1728475293,
"raw_offset": 0,
"week_number": 41,
"dst": true,
"abbreviation": "BST",
"dst_offset": 3600,
"dst_from": "2024-03-31T01:00:00+00:00",
"dst_until": "2024-10-27T01:00:00+00:00",
"client_ip": "xx.xx.xx.xx"
}
Code language: JSON / JSON with Comments (json)
You can then tell Cursor in the Chat or the Composer. I’ve also added it to .cursorrules
.
You can also add the URL as an @Doc
, which is how I use it most.
Leave a Reply