-
Notifications
You must be signed in to change notification settings - Fork 375
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
Timezones #6822
Closed
Closed
Timezones #6822
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
735bc72
add DateTimeTraits
sixlighthouses 24f4b24
Merge remote-tracking branch 'origin/main' into timezones
sixlighthouses 045f9d1
add in timeZone trtait and make use of dateFormat
sixlighthouses 6c85660
update Timeline.tsx in BottomDock to use datetime traits
sixlighthouses ec05a2b
remove box set height to allow for 2 lines in datetime text
sixlighthouses 1d404b8
update spec for date check
sixlighthouses 5c3eac5
update CHANGES
sixlighthouses 87bca7b
remove some console.logs and add regex check for timeZone
sixlighthouses 2fccd67
get rid of one more console.log
sixlighthouses 68c1b52
add some more tests
sixlighthouses 0363eb7
correct test titlefor invalid timeZone
sixlighthouses a696c47
need to adjust the tests to be running from UTC Z
sixlighthouses 70a90d0
add isStaticDate trait and check for it in DateTimeSelectorSection
sixlighthouses 18b4e39
refactor use of DateUtils methods, dd some comments
sixlighthouses 703bb8e
Merge remote-tracking branch 'origin/main' into timezones
sixlighthouses 3fa3d8d
linter fixes
sixlighthouses b958d0b
fix CHANGES
sixlighthouses b444618
revisit unit tests
sixlighthouses File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function getOffsetMinutes(timeZone: string): number { | ||
const [hoursString, minutesString] = timeZone.split(":"); | ||
const hours = parseInt(hoursString); | ||
const minutes = parseInt(minutesString); | ||
return hours * 60 + minutes; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ModelTraits from "../ModelTraits"; | ||
import primitiveTrait from "../Decorators/primitiveTrait"; | ||
|
||
export class DateTimeTraits extends ModelTraits { | ||
@primitiveTrait({ | ||
type: "string", | ||
name: "Timezone", | ||
description: | ||
"If the DateTime attribute values do not have timezone information" + | ||
" (e.g. 2018-01-01T00:00:00), specify the ISO timezone with offset from UTC (e.g. +10:00)" | ||
}) | ||
timeZone?: string; | ||
|
||
@primitiveTrait({ | ||
type: "string", | ||
name: "Date format", | ||
description: | ||
"See available formats here https://github.com/felixge/node-dateformat" | ||
}) | ||
dateFormat?: string; | ||
} | ||
|
||
export default DateTimeTraits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails when a timeZone of "+11" is used. I think it'd be good to support that form of timezone too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added regex check, so the function now checks for the timeZone to be in the format +/- HH:MM or +/-HH if not it will return 0 in which case no offset will be applied