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

feat: Naive DateTimes #36

Merged
merged 1 commit into from
Nov 2, 2020
Merged

feat: Naive DateTimes #36

merged 1 commit into from
Nov 2, 2020

Conversation

staylorwr
Copy link
Contributor

@staylorwr staylorwr commented Oct 30, 2020

This PR adds a feature to the DateTime field which allows it to better handle
naive datetimes by disregarding timezones and allowing the user and Vue app to
render and manipulate the field's value without considering the browsers
timezone or UTC time.

It also cleans up some invalid props passed to the datetime picker and ensures a
better default for DateTime formatting when a specific format is not specified.

Finally, it cleans up the borders and font colors of the input fields to offer
better contrast.

Screenshots

Form View:

Screen Shot 2020-10-30 at 4 55 33 PM

Index View:

Screen Shot 2020-10-30 at 4 55 40 PM

Detail View

Screen Shot 2020-10-30 at 4 55 28 PM

Screen Shot 2020-10-30 at 4 55 50 PM

Screen Shot 2020-10-30 at 4 56 00 PM

…ve a timezone and does not use browser timezones to configure the values
@staylorwr staylorwr merged commit 4b96d70 into master Nov 2, 2020
@staylorwr staylorwr deleted the st/datetime-with-timezone branch November 2, 2020 14:10
return;
}

if (this.naiveDateTime) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a return on line 56 that prevents this from being reached if there is already a value. That initial value would be parsed as if it were a UTC datetime even if it's naive

});

this.value = `${dt.toFormat('yyyy-M-dd')}T${dt.toFormat('TT')}`;
this.localizedValue = dt.toLocaleString(DateTime.DATETIME_MED);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are value and localized value formatted differently?

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

Successfully merging this pull request may close these issues.

None yet

2 participants