hammady / wwpray

A website that shows the prayer times for a preconfigured list of masjids in a tabular format. Visitors can subscribe for email notifications.
https://wwpray.net
MIT License
1 stars 0 forks source link

Show last updated timestamp in relative time format #6

Closed hammady closed 1 year ago

fayez-nazzal commented 1 year ago

@hammady

I think dayjs is a solid option and the most minimal. We can go more advanced using luxon, but I don't see any need now.

There is also an option to use JavaScript's temporal API polyfill, then when browsers' JavaScript officially supports it, we can remove it without any more changes.

All mentioned options are superior to moment, especially for dev experience and cleanness.

Let me know your thoughts!

hammady commented 1 year ago

I trust your judgement for the best approach.

hammady commented 1 year ago

@fayez-nazzal The scope will change soon to show last_updated timestamp for each masjid individually. See #47.

fayez-nazzal commented 1 year ago

@hammady I just read this comment, alright!

hammady commented 1 year ago

New schema:

{
    "max_jumaas": 2,
    "masjids": {
        "ICCO": {
            "iqamas": {
                "fajr": {
                    "time": "6:50 am",
                    "changed": true
                },
                "zuhr": {
                    "time": "2:00 pm"
                },
                "asr": {
                    "time": "4:45 pm"
                },
                "maghrib": {
                    "time": "6:35 pm"
                },
                "isha": {
                    "time": "8:00 pm"
                }
            },
            "jumas": [
                "12:35 P.M. by Jawad Salman (English)",
                "1:30 P.M. by Wael Hamadeh (English)",
                "2:45 P.M. by Sheikh Samir Khalil (Arabic)"
            ],
            "jumas_changed": true,
            "last_updated": "2023-10-21T03:41:47.555916"
        }
    }
}
hammady commented 1 year ago

The last_updated timestamp shows the UTC time in iso format. Without JS, it would show as is. With JS, it needs to be shown relatively.

hammady commented 1 year ago

@fayez-nazzal Probably this is not the latest code but it shows in 13 minutes while it should be 4 hours ago. Is there a timezone issue? My time zone is -4. image

hammady commented 1 year ago

I think there is a timezone issue. This timestamp is 3am EST or 7am UTC. It is now showing 10 minutes ago and the time now EST is 7:10. It handles the value as being in current timezone while it should be parsed as UTC. image

fayez-nazzal commented 1 year ago

@hammady Ops..my fault, I will fix this.