Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Date field in the header from timestamp to human readable date #10

Closed
hbostan opened this issue Feb 3, 2020 · 0 comments
Closed

Comments

@hbostan
Copy link
Collaborator

hbostan commented Feb 3, 2020

Description

Currently we are writing the timestamp received from Discourse directly to the message header. This timestamp is in UTC and may cause confusion/problems when used in different timezones.

We need to be able to adjust the timezone (possibly via conf.ini file) and create the Date field in the message header in this timezone. Also we should make it (more) human readable, since the timestamp format is a bit hard to read.

Relevant Files

newsreader.py
driver.py

goksgie added a commit to goksgie/COWNotifier that referenced this issue Feb 3, 2020
This commit presents a human readable date format for message timestamps.

Why?

* Unfortunately, the default timestamp `%Y:%m:%dT%H:%M:%S.xxZ` is not
human readable.

Changes:

* Users can get the timestamp in more readable form of `%d %b %Y, %H:%M:%S`.
As an example, `03 Feb 2020, 18:30:00`

Affected Classes:

* `config` file gets a new member under `news` keyword, namely
timestamp. It represents the user's local timezone in the UTC format. As
an example, Turkey's local timezone is UTC +3.00, so the timezone field
should be "3.00".

* `newsArticle` gets a new function, `getHumanReadableDate`, accepting
raw timestamp and local timezone. The local timestamp is parsed to the
form of list of two integers, they represent hours and minutes
respectively.

* `newsReader` also gets a new member, called timezone. Since we always
create `newsArticle`, performing the parsing operation in the
constructor made a lot of sense, to avoid unnecessary computations.

This commit should resolve the issue kadircet#10.
goksgie added a commit to goksgie/COWNotifier that referenced this issue Feb 3, 2020
This commit presents a human readable date format for message timestamps.

Why?

* Unfortunately, the default timestamp `%Y:%m:%dT%H:%M:%S.xxZ` is not
human readable.

Changes:

* Users can get the timestamp in more readable form of `%d %b %Y, %H:%M:%S`.
As an example, `03 Feb 2020, 18:30:00`

Affected Classes:

* `config` file gets a new member under `news` keyword, namely
timestamp. It represents the user's local timezone in the UTC format. As
an example, Turkey's local timezone is UTC +3.00, so the timezone field
should be "3.00".

* `newsArticle` gets a new function, `getHumanReadableDate`, accepting
raw timestamp and local timezone. The local timestamp is parsed to the
form of list of two integers, they represent hours and minutes
respectively.

* `newsReader` also gets a new member, called timezone. Since we always
create `newsArticle`, performing the parsing operation in the
constructor made a lot of sense, to avoid unnecessary computations.

This commit should resolve the issue kadircet#10.
hbostan pushed a commit that referenced this issue Feb 3, 2020
* Add human readable timestamp

This commit presents a human readable date format for message timestamps.

Why?

* Unfortunately, the default timestamp `%Y:%m:%dT%H:%M:%S.xxZ` is not
human readable.

Changes:

* Users can get the timestamp in more readable form of `%d %b %Y, %H:%M:%S`.
As an example, `03 Feb 2020, 18:30:00`

Affected Classes:

* `config` file gets a new member under `news` keyword, namely
timestamp. It represents the user's local timezone in the UTC format. As
an example, Turkey's local timezone is UTC +3.00, so the timezone field
should be "3.00".

* `newsArticle` gets a new function, `getHumanReadableDate`, accepting
raw timestamp and local timezone. The local timestamp is parsed to the
form of list of two integers, they represent hours and minutes
respectively.

* `newsReader` also gets a new member, called timezone. Since we always
create `newsArticle`, performing the parsing operation in the
constructor made a lot of sense, to avoid unnecessary computations.

This commit should resolve the issue #10.

* Removed floating timezones

Removed the floating representations of timezones, in the form of
`3.30`. We only accept `integer` zones.
@hbostan hbostan closed this as completed Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants