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
Legacy browser support #2976
Merged
Merged
Legacy browser support #2976
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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,35 @@ | ||
(function(){ | ||
var dateFormatter = function dateFormatter() { | ||
|
||
}; | ||
|
||
dateFormatter.parse = function(date_string) { | ||
var timestamp = new Date(date_string).getTime(); | ||
|
||
if (isNaN(timestamp)) { | ||
timestamp = dateFormatter.parseISO8601UTC(date_string); | ||
} | ||
|
||
return timestamp; | ||
}, | ||
|
||
dateFormatter.parseISO8601UTC = function(date_string) { | ||
var iso8601_utc_pattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.(\d{3}))?Z$/; | ||
var time_components = date_string.match(iso8601_utc_pattern); | ||
var timestamp = 0; | ||
|
||
if (time_components != null) { | ||
if (time_components[8] == undefined) { | ||
time_components[8] = 0; | ||
} | ||
|
||
timestamp = Date.UTC(time_components[1], time_components[2] - 1, time_components[3], | ||
time_components[4], time_components[5], time_components[6], | ||
time_components[8]); | ||
} | ||
|
||
return timestamp; | ||
}, | ||
|
||
app.helpers.dateFormatter = dateFormatter; | ||
})(); |
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,33 @@ | ||
describe("app.helpers.dateFormatter", function(){ | ||
|
||
beforeEach(function(){ | ||
this.statusMessage = factory.post(); | ||
this.formatter = app.helpers.dateFormatter; | ||
}) | ||
|
||
describe("parse", function(){ | ||
context("modern web browsers", function(){ | ||
it ("supports ISO 8601 UTC dates", function(){ | ||
var timestamp = new Date(this.statusMessage.get("created_at")).getTime(); | ||
expect(this.formatter.parse(this.statusMessage.get("created_at"))).toEqual(timestamp); | ||
}) | ||
}) | ||
|
||
context("legacy web browsers", function(){ | ||
it("supports ISO 8601 UTC dates", function(){ | ||
var timestamp = new Date(this.statusMessage.get("created_at")).getTime(); | ||
|
||
expect(this.formatter.parseISO8601UTC(this.statusMessage.get("created_at"))).toEqual(timestamp); | ||
}) | ||
}) | ||
|
||
context("status messages", function(){ | ||
it("uses ISO 8601 UTC dates", function(){ | ||
var iso8601_utc_pattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.(\d{3}))?Z$/; | ||
|
||
expect(iso8601_utc_pattern.test(this.statusMessage.get("created_at"))).toBe(true); | ||
}) | ||
}) | ||
}) | ||
|
||
}) |
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.
is this related to the bugfix? the publisher is so wonky that I am actually sorta nervous about this change...
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.
No. It was a separate fix for a JavaScript error that I noticed in the Safari error console.
https://poddery.com/custom/github/diaspora-2976-unmatched-tags-error.gif
If you omit that change, the main problem of the posts appearing in the reverse order will still be corrected. The older version of Safari appears to operate fine with the particular change omitted.
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.
thanks!