Skip to content

Commit

Permalink
fixes date transform
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrothwell committed Oct 1, 2024
1 parent 5e3738c commit f3a8ea8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/composables/useTransforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// composable functions as needed

import accounting from 'accounting';
import { format, parseISO } from 'date-fns';
import { UTCDate } from '@date-fns/utc';
import { formatInTimeZone } from 'date-fns-tz';
// import { format, parseISO } from 'date-fns';

accounting.settings.currency.precision = 0;

Expand All @@ -16,12 +16,12 @@ export default function useTransforms() {
if (!value) return;
let valueTransformed;
if (import.meta.env.VITE_DEBUG == 'true') console.log('date transform running, value:', value, 'typeof value:', typeof value);
if (typeof value === 'string') {
console.log('date transform parseISO(value):', parseISO(value));
valueTransformed = format(parseISO(value), 'MM/dd/yyyy');
} else {
valueTransformed = format(value, 'MM/dd/yyyy');
}
// if (typeof value === 'string') {
// console.log('date transform parseISO(value):', parseISO(value));
valueTransformed = formatInTimeZone(value, 'America/New_York', 'MM/dd/yyyy');
// } else {
// valueTransformed = formatInTimeZone(value, 'America/New_York', 'MM/dd/yyyy');
// }
return valueTransformed;
}

Expand Down

0 comments on commit f3a8ea8

Please sign in to comment.