Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
This repository was archived by the owner on May 13, 2025. It is now read-only.

sms time come in UTC #11

@shorbagi

Description

@shorbagi

Hi

When I receive the sms it come in UTC when my appointment is set to Asia/Dubai.
I got it working using arrow convert method like this in tasks.py file:

@dramatiq.actor
def send_sms_reminder(appointment_id):
    """Send a reminder to a phone using Twilio SMS"""
    # Get our appointment from the database
    try:
        appointment = Appointment.objects.get(pk=appointment_id)
    except Appointment.DoesNotExist:
        # The appointment we were trying to remind someone about
        # has been deleted, so we don't need to do anything
        return

>     appointment_time = arrow.get(appointment.time)
>     appointment_zone = appointment_time.to(appointment.time_zone)
>     body = 'Hi {0}. You have an appointment coming up at {1}.'.format(
>         appointment.name,
>         appointment_zone.format('h:mm a')
>     )

    client.messages.create(
        body=body,
        to=appointment.phone_number,
        from_=settings.TWILIO_NUMBER,
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions