question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"date" field in Message object is returned incorrectly

See original GitHub issue

As seen in documentation: date | Integer | Date the message was sent in Unix time

Aiogram returns formatted datetime instead which is incorrect (expected integer as seen in docs) and makes harder to port code from other libraries.

Test case:

@dp.message_handler()
async def show_datetime(message: types.Message):
    print(message.date)
    return

Expected output: >>> 1532863711

Got output: >>> 2018-07-29 11:28:31

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
MasterGrooshacommented, Jul 29, 2018

@JrooTJunior Of course, I can write any number of “helper” methods. The thing is: you’re making a simple API complex just because you want to. But this is not your project (originally). All you had to do was to

  1. Replicate Bot API methods “as is”
  2. Do whatever you want since you’re creator of library.

I appreciate your “2)”, but you’ve completely failed “1)”. I see you (and community behind you) don’t see any problems here and don’t even feel guilty, so I’ll just close the issue. Good luck making simple things harder because of your fantasies.

3reactions
mahenzoncommented, Jul 29, 2018

Yeah, this is an issue, that @JrooTJunior has to fix (or anyone else) + this: forward_date: base.Integer = fields.Field()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return error message if date format isn't correct
Try this: convert.to.date <- function(d) { if(is.na(strptime(d, '%Y-%m-%d %H:%M:%S'))) stop("Format incorrect") return(format(d, ...
Read more >
Error: Incorrect parameter type for operator '-'. Expected ...
This error is expected because the operator - requires both the operand of same data type. The NOW() returns a datetime and other...
Read more >
Solved: Change date format received from MS Forms in MS Fl...
I have an approval 'Leave Request' flow. It is triggered when a response has been received from an MS Form.
Read more >
The Definitive Guide to DateTime Manipulation
The problem with this solution is that it can give an inconsistent length to the dates because some months and days of the...
Read more >
Why do date fields import incorrectly when I use the Data ...
Sometimes dates import incorrectly because the Data Loader converts the date specified in the imported .csv file to GMT. If your machine's time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found