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

sms time come in UTC #11

Open
shorbagi opened this issue Dec 31, 2018 · 0 comments
Open

sms time come in UTC #11

shorbagi opened this issue Dec 31, 2018 · 0 comments

Comments

@shorbagi
Copy link

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,
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant