Skip to content

Commit

Permalink
Fix RSS feed dates
Browse files Browse the repository at this point in the history
  • Loading branch information
fwextensions committed Oct 12, 2024
1 parent 75ff5b3 commit fd173f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/dayjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ dayjs.extend(timezone);
dayjs.extend(customParseFormat);

// interpret all date strings as Pacific time, in case this gets built in some
// other time zone
// other time zone. make sure to call the .tz() method instead of just dayjs().
dayjs.tz.setDefault("America/Los_Angeles");

export default dayjs;

export const parseYMD = (date: string) => dayjs(date, "YYYY-MM-DD", true);
export const parseYMD = (date: string) => dayjs.tz(date);
export const parseYMDToDate = (date: string) => parseYMD(date).toDate();
export const formatShortMDY = (date: Date) => date ? dayjs(date).format("MMM D, YYYY") : "";
export const formatRSSDate = (date: Date) => date ? dayjs(date).format("ddd, D MMM YYYY HH:mm:ss ZZ") : "";
export const formatShortMDY = (date: Date) => date ? dayjs.tz(date).format("MMM D, YYYY") : "";
export const formatRSSDate = (date: Date) => date ? dayjs.tz(date).format("ddd, D MMM YYYY HH:mm:ss ZZ") : "";

0 comments on commit fd173f0

Please sign in to comment.