library-pals / bookmark-action

🔖 A GitHub action to bookmark websites to a JSON file
https://katydecorah.com/code/bookmark-action/
MIT License
30 stars 6 forks source link

Time support with the date property #158

Closed flamedfury closed 8 months ago

flamedfury commented 8 months ago

Hello Katy, me again :)

Would it be possible to add in a time stamp from when the action saves the bookmark to the JSON file? e.g. date: 2024-04-05T20:07:30Z

This would help when I save multiple bookmarks per day, when they're posted to the RSS feed they all currently have the time 00:00.

katydecorah commented 8 months ago

Sure thing! Here's what I'd like to propose @flamedfury:

  1. Add new timestamp property where the value is an ISO string. Example: "timestamp": "2024-04-06T17:30:00.000Z",
  2. Update bookmarks already in the JSON file by checking if they have timestamp if not, add one based on the date. Example:
    {
    "date": "2021-01-03",
    "site": "NYT Cooking",
    "timestamp": "2021-01-03T00:00:00.000Z", // Time is blank for previous bookmarks as we don't know, but at least gives us a consistent format
    "title": "Cornmeal Lime Shortbread Fans Recipe",
    "url": "https://cooking.nytimes.com/recipes/1021663-cornmeal-lime-shortbread-fans",
    }
  3. The date property remains the same (we could deprecate in the future, but I'm not too worried about it).

This helps prevent breaking anyone's current implementation of date and anyone who wants to start using the iso string can update their implementations to swap date with timestamp.

What do you think?

flamedfury commented 8 months ago

@katydecorah this sounds wonderful, I can work with this

katydecorah commented 8 months ago

Released in v7.0.0!

flamedfury commented 7 months ago

Works a treat 🎉

image

Thanks again :)

katydecorah commented 7 months ago

So cool 🤩