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

Is it possible to view/edit naivedatetime in browser's local timezone #477

Closed
axelson opened this issue Aug 21, 2024 · 2 comments
Closed

Comments

@axelson
Copy link
Contributor

axelson commented Aug 21, 2024

If I have an ecto schema that has field :started_at, :naive_datetime, then is it possible to display and edit the timezone in the browsers local timezone instead of UTC?

The generated form field looks like:

<.form :let={f} for={@changeset} action={@action} id="torch-form" enctype="multipart/form-data">
  ...
  <.torch_input label="Started at" field={f[:started_at]} type="datetime-local" />
  ...
</.form>

This is the UI that gets rendered (12:14pm in UTC is 7:14am in my local timezone):
Screenshot 2024-08-21 08-09-41@2x

@cpjolicoeur
Copy link
Member

Sure, you can manipulate and format your data however you want. Torch is simple a template generate and you are free to 1) change the templates, or 2) manipulate your time data into local timezones as you see fit for display.

@axelson
Copy link
Contributor Author

axelson commented Aug 25, 2024

Okay, here's how I've solved it via javascript so I can use the brower's local timezone: axelson/pomodoro_phx#1

@axelson axelson closed this as completed Aug 25, 2024
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

2 participants