mendhak / waveshare-epaper-display

At-a-glance dashboard for Raspberry Pi with a Waveshare ePaper 7.5 Inch HAT. Date/Time, Weather, Alerts, Google/Outlook Calendar
https://code.mendhak.com/raspberrypi-epaper-dashboard/
449 stars 66 forks source link

Friendly calendar dates, using 'today', 'tonight', 'tomorrow' and day names #36

Closed mendhak closed 2 years ago

mendhak commented 2 years ago

This PR uses friendly day names for events which are happening soon (Today, Monday...). It removes the date (Apr 11) for coming-soon events. I saw this on jmason's fork and wanted to reimplement it here with some extra logic.

If the event is today, use the word 'Today' instead of 'Friday'.

If the event is today after sunset, use the word 'Tonight' instead of 'Today'.
(Is that going too far?)

If the event is tomorrow, use the word 'Tomorrow' instead of 'Saturday'.

If the event is within the next 6 days, just display the day name 'Monday' instead of 'Monday Apr 11'. (Should this be within the next 3 days instead of 6 days?)

Finally, just use the regular 'Sat Apr 16...' format for events beyond that.

image

jmason commented 2 years ago

awesome :)