Skip to content

Commit

Permalink
Avoid timezone errors where spacetime calculates the wrong epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Oct 16, 2024
1 parent bc959c6 commit 9303699
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"socket.io-client": "^4.0.1",
"spacetime": "^7.4.1",
"spacetime": "^7.6.2",
"spacetime-informal": "^0.6.1",
"timesync": "^1.0.11",
"typescript": "^5.4.5",
Expand Down
4 changes: 2 additions & 2 deletions website/src/utils/content-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,14 @@ function getNoSunAbbreviation(abbrev) {
*
* @param {ParsableDate | Date | number | Array<number> | string} timeString - spacetime parsable date/time string
* @param {string?} tz - site timezone from store
* @param {string?} format - override for format
* @param {string} format - override for format
* @param {boolean?} use24HourTime - use 24 hour time
* @returns {string}
*/
export function formatTime(timeString, { tz, use24HourTime = false, format = "{day-short} {date-ordinal} {month-short} {year} {time} {tz}" } = {}) {
if (!tz) tz = useSettingsStore().timezone;
const timezone = getTimezone(tz);
const time = spacetime(timeString).goto(timezone);
const time = spacetime((new Date(timeString)).getTime()).goto(timezone);
const abbrev = getAbbrev(timezone, time);
return time.format(
format
Expand Down

0 comments on commit 9303699

Please sign in to comment.