This is a migrated thread and some comments may be shown as answers.

Values and format of dates

5 Answers 75 Views
Push Notifications
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 30 Sep 2015, 03:30 PM

The message structure http://docs.telerik.com/platform/backend-services/rest/push-notifications/push-structure mentions ​certain date fields. I cannot find further information about what the expected values and format of dates should be.

 

It seems that they're expected to be a BSON value which is UTC (which excludes a timezone). And it seems that they're expected in ISO date format but that's just a guess.

 

Anyone have pointers to further doc?

5 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 01 Oct 2015, 04:03 PM
Hello Peter,

Thank you for posting to the Telerik Developer Forums.

Indeed, the Date fields mentioned in the referenced article are referred to as Date and Time fields used in Backend Services as shown here.

You are right, the dates are expected in ISO-8601 date format and on the server they will be converted (if offset is not already specified in the incoming date) to the YYYY-MM-DDTHH:mm:ss.mmm-offset format.

Let me know if you have further questions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Peter
Top achievements
Rank 1
answered on 01 Oct 2015, 04:08 PM

Anton,

 Thanks for the reply.

I will reconfirm with my QA but it seems that something like

{ "UseLocalTime": true,
  "NotificationDate": "2015-09-28T18:42:39.021+05:30",
//snip

fails to send the notification. The response is a success response.

0
Anton Dobrev
Telerik team
answered on 02 Oct 2015, 01:49 PM
Hello Peter,

I can confirm that this format for a NotificationDate is a valid one and should be working as expected - schedule a notification that will be sent when the time in the object according to the device's time zone occurs. 

Could you please specify the payload of the request that creates the notification and the way the push notification looks in the project? You can retrieve the inserted notification object with an HTTP request as shown here.

Can you receive notifications that are sent immediately?

I look forward to your reply.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Peter
Top achievements
Rank 1
answered on 06 Oct 2015, 05:40 PM

Hi Anton,

I think I'm a little closer. If I try to send notifications from the Telerik Platform Push Browser and I have no devices, the Platform Push Browser gives me an error "NotificationDate cannot be set before the current moment", even though it's in (my) future. See attached for an example.  If I use a date/time that's in the future for Earth then it schedules the message.

I can send the same message, if I don't use the user's timezone.

0
Anton Dobrev
Telerik team
answered on 08 Oct 2015, 04:35 PM
Hi Peter,

Thank you for specifying this.

Indeed, there is a validation about this on the server but it does not cover the current number of devices (because it cannot validate how much devices you are going to have in the future). 

At the current stage, the validation will cut down requests with UseLocalTime set to true that try to schedule a notification which NotificationDate is in the past according to UTC time. This means that if your time zone is -5 hours UTC time, you cannot schedule a notification with a notification date in the next 5 hours ahead of the current time in your time zone. Can you confirm that this is the behavior you encountered?

I do agree that there are some missing explanations in the docs on this matter which we will address.

Meanwhile, let me know if you have further questions or suggestions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Push Notifications
Asked by
Peter
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
Peter
Top achievements
Rank 1
Share this question
or