Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Clean up date format.
James Cole2adba29c4825
diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex c030cb8bfc..7ede37464d 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -345,7 +345,7 @@ class Amount$currency = TransactionCurrency::whereCode($code)->first();if (null === $currency) {$message = sprintf('Could not find a transaction currency with code "%s" in %s', $code, __METHOD__);- Log::error($message);+ // Log::error($message);throw new FireflyException($message);}@@ -372,7 +372,7 @@ class Amount$currency = TransactionCurrency::find($currencyId);if (null === $currency) {$message = sprintf('Could not find a transaction currency with ID #%d in %s', $currencyId, __METHOD__);- Log::error($message);+ // Log::error($message);throw new FireflyException($message);}diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.jsindex 6b1e28a624..effe71227f 100644--- a/resources/assets/v3/js/pages/accounts/index.js+++ b/resources/assets/v3/js/pages/accounts/index.js@@ -25,7 +25,7 @@ import Alpine from "@alpinejs/csp";import { getVariable } from "../../store/get-variable.js";import Put from "../../api/model/account/put.js";import Get from "../../api/model/account/get.js";-import format from "../../util/format.js";+import formatDate from "../../util/format-date.js";import formatMoney from "../../util/format-money.js";import i18next from "i18next";import { addDrag } from "../shared/drag-and-droppable-rows.js";@@ -314,7 +314,7 @@ let index = function () {if (null === date) {return "";}- return format(+ return formatDate(new Date(date),i18next.t("config.date_time_fns_short", { lng: window.store.get("locale") }),window.store.get("locale"),diff --git a/resources/assets/v3/js/pages/dashboard/boxes.js b/resources/assets/v3/js/pages/dashboard/boxes.jsindex 9d8dadbce9..f8caacaaa0 100644--- a/resources/assets/v3/js/pages/dashboard/boxes.js+++ b/resources/assets/v3/js/pages/dashboard/boxes.js@@ -19,11 +19,11 @@*/import Summary from "../../api/summary/index.js";-import { format } from "date-fns";import { getVariables } from "../../store/get-variables.js";import formatMoney from "../../util/format-money.js";import { getCacheKey } from "../../support/get-cache-key.js";import { cleanupCache } from "../../support/cleanup-cache.js";+import formatDate from "../../util/format-date.js";let afterPromises = false;export default () => ({@@ -72,7 +72,7 @@ export default () => ({// get stufflet getter = new Summary();getter- .get(format(start, "yyyy-MM-dd"), format(end, "yyyy-MM-dd"), null)+ .get(formatDate(start, "yyyy-MM-dd"), formatDate(end, "yyyy-MM-dd"), null).then((response) => {this.boxData = response.data;window.store.set(boxesCacheKey, response.data);diff --git a/resources/assets/v3/js/pages/dashboard/dashboard.js b/resources/assets/v3/js/pages/dashboard/dashboard.jsindex a1eb49fb17..de186da034 100644--- a/resources/assets/v3/js/pages/dashboard/dashboard.js+++ b/resources/assets/v3/js/pages/dashboard/dashboard.js@@ -28,7 +28,7 @@ import formatMoney from "../../util/format-money.js";import { getVariable } from "../../store/get-variable.js";import { getVariables } from "../../store/get-variables.js";import { drawMultiCurrencyChart } from "../../shared/draw-chart.js";-import format from "../../util/format.js";+import formatDate from "../../util/format-date.js";let index = function () {return {@@ -44,8 +44,21 @@ let index = function () {const lastTimeDialog = 'lt_' + version;getVariables([whatsNewDialog, lastTimeDialog]).then((values) => {const shownWhatsNewDialog = true === values[whatsNewDialog];- const lastShowTime = null === values[lastTimeDialog] ? 0 : parseInt(values[lastTimeDialog]);- console.log(lastShowTime);+ const lastShowTime = null === values[lastTimeDialog] ? 0 : parseInt(values[lastTimeDialog]) * 1000;+ // const lastShowTime = (1791297200 - (48*60*60)) * 1000;+ if(0 === lastShowTime && !shownWhatsNewDialog) {+ console.log('User needs new feature dialogue.');+ // alert('Show dialog because never seen before.');+ }+ if(!shownWhatsNewDialog && lastShowTime > 0) {+ const now = new Date().getTime();+ const diff = now - lastShowTime;+ const diffInDays = diff / (1000 * 60 * 60 * 24);+ if(diffInDays > 2) {+ console.log('User needs new feature dialogue.');+ }+ }+// alert(whatsNewDialog + ' is ' + (null === values[whatsNewDialog]));// alert(lastTimeDialog + ' is ' + (null === values[lastTimeDialog]));});@@ -61,9 +74,9 @@ let index = function () {drawMultiCurrencyChart("line","api/v1/chart/account/overview?period=1D&start=" +- format(start, "yyyy-LL-dd") ++ formatDate(start, "yyyy-LL-dd") +"&end=" +- format(end, "yyyy-LL-dd"),+ formatDate(end, "yyyy-LL-dd"),"accounts-chart",value,true,@@ -73,9 +86,9 @@ let index = function () {drawMultiCurrencyChart("stacked-column","api/v1/chart/budget/overview-with-limits?start=" +- format(start, "yyyy-LL-dd") ++ formatDate(start, "yyyy-LL-dd") +"&end=" +- format(end, "yyyy-LL-dd"),+ formatDate(end, "yyyy-LL-dd"),"budgets-chart",value,false,diff --git a/resources/assets/v3/js/pages/exchange-rates/rates.js b/resources/assets/v3/js/pages/exchange-rates/rates.jsindex 0fa0bcd060..e52f8f8069 100644--- a/resources/assets/v3/js/pages/exchange-rates/rates.js+++ b/resources/assets/v3/js/pages/exchange-rates/rates.js@@ -22,7 +22,6 @@import "../../boot/bootstrap.js";import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";-import { format } from "date-fns/format";import i18next from "i18next";import Post from "../../api/model/exchange-rate/post.js";import Put from "../../api/model/exchange-rate/put.js";@@ -30,6 +29,7 @@ import Delete from "../../api/model/exchange-rate/delete.js";import Get from "../../api/model/currency/get.js";import GetRate from "../../api/model/exchange-rate/get.js";import Alpine from "@alpinejs/csp";+import formatDate from "../../util/format-date.js";let rates = function () {return {@@ -54,7 +54,7 @@ let rates = function () {totalPages: 1,init() {this.i18next = i18next;- this.newDate = format(new Date(), "yyyy-MM-dd");+ this.newDate = formatDate(new Date(), "yyyy-MM-dd");let parts = window.location.pathname.split("/");this.from_code = parts[parts.length - 2].toUpperCase();this.to_code = parts[parts.length - 1].toUpperCase();@@ -233,13 +233,13 @@ let rates = function () {let inverse = "";let rate_id = current.id;let inverse_id = "0";- let key = from_code + "_" + to_code + "_" + format(date, "yyyy-MM-dd");+ let key = from_code + "_" + to_code + "_" + formatDate(date, "yyyy-MM-dd");// console.log('Key is now "' + key + '"');// perhaps the returned rate is actually the inverse rate.if (from_code === this.to_code && to_code === this.from_code) {// console.log('Inverse rate found!');- key = to_code + "_" + from_code + "_" + format(date, "yyyy-MM-dd");+ key = to_code + "_" + from_code + "_" + formatDate(date, "yyyy-MM-dd");rate = "";// new: set rate id to zero.rate_id = "0";@@ -255,7 +255,7 @@ let rates = function () {date: date,rate_id: rate_id,inverse_id: inverse_id,- date_formatted: format(+ date_formatted: formatDate(date,i18next.t("config.date_time_fns", { lng: window.store.get("locale") }),window.store.get("locale"),diff --git a/resources/assets/v3/js/pages/profile/oauth.js b/resources/assets/v3/js/pages/profile/oauth.jsindex 5de61320b0..384ed05e94 100644--- a/resources/assets/v3/js/pages/profile/oauth.js+++ b/resources/assets/v3/js/pages/profile/oauth.js@@ -23,8 +23,9 @@ import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";import i18next from "i18next";import { api } from "../../boot/axios";-import { Modal } from "bootstrap";+import * as bootstrap from 'bootstrap';import Alpine from "@alpinejs/csp";+import formatDate from "../../util/format-date.js";let index = function () {return {@@ -105,10 +106,19 @@ let index = function () {* Get all of the personal access tokens for the user.*/getTokens() {+ const locale = window.store.get("locale");// console.log("getTokens()");api.get("./oauth/personal-access-tokens").then((response) => {// console.log(response.data);- this.tokens = response.data;+ for(let i=0;i<response.data.length; i++) {+ if(Object.hasOwn(response.data, i)) {+ let token = response.data[i];+ console.log(i18next.t("config.date_time_fns", { lng: locale }));+ token.expires_at = formatDate(new Date(token.expires_at), i18next.t("config.date_time_fns", { lng: locale }), locale);+ this.tokens.push(token);+ }+ }+ // this.tokens = response.data;});},@@ -117,7 +127,7 @@ let index = function () {*/showCreateTokenForm() {// console.log("showCreateTokenForm()");- new Modal(document.getElementById("modal-create-token"), {}).show();+ new bootstrap.Modal(document.getElementById("modal-create-token"), {}).show();},/**@@ -131,9 +141,7 @@ let index = function () {api.post("./oauth/personal-access-tokens", this.form).then((response) => {- // console.log(- // "Successful POST new token, reset form content.",- // );+ console.log("Successful POST new token, reset form content.",);this.form.name = "";this.form.scopes = [];this.form.errors = [];@@ -161,11 +169,19 @@ let index = function () {*/showAccessToken(accessToken) {// console.log("showAccessToken");- new Modal(document.getElementById("modal-create-token"), {}).hide();-+ let modal = new bootstrap.Modal(document.getElementById("modal-create-token"), {});this.accessToken = accessToken;+ console.log('here we are', modal);+ // modal.toggle();+ // modal.toggle();++ modal.addEventListener('hidden.bs.modal', function () {+ new Modal(document.getElementById("modal-access-token"), {}).show();+ });+++- new Modal(document.getElementById("modal-access-token"), {}).show();},getClients() {api.get("./oauth/clients").then((response) => {@@ -174,7 +190,7 @@ let index = function () {});},showCreateClientForm() {- new Modal(document.getElementById("modal-create-client"), {}).show();+ new bootstrap.Modal(document.getElementById("modal-create-client"), {}).show();},/*** Persist the client to storage using the given form.@@ -190,14 +206,20 @@ let index = function () {form.redirect_uris = "";form.errors = [];- new Modal(document.querySelector(modal), {}).hide();+ document.addEventListener("hidden.bs.modal", function () {+ console.log('Closed??');+ });++ new bootstrap.Modal('#' + modal, {}).hide();+if (response.data.plainSecret) {- this.showClientSecret(response.data.plainSecret);+ // this.showClientSecret(response.data.plainSecret);}}).catch((error) => {- if (typeof error.response.data === "object") {+ console.error(error);+ if (typeof error.response === "object" && typeof error.response.data === "object") {for (const value of Object.entries(error.response.data.errors)) {form.errors.push(value);}@@ -242,7 +264,7 @@ let index = function () {* Create a new OAuth client for the user.*/store() {- this.persistClient("post", "./oauth/clients", this.createForm, "#modal-create-client");+ this.persistClient("post", "./oauth/clients", this.createForm, "modal-create-client");},/*** Edit the given client.@@ -259,7 +281,7 @@ let index = function () {* Update the client being edited.*/update() {- this.persistClient("put", "./oauth/clients/" + this.editForm.id, this.editForm, "#modal-edit-client");+ this.persistClient("put", "./oauth/clients/" + this.editForm.id, this.editForm, "modal-edit-client");},};};diff --git a/resources/assets/v3/js/pages/shared/dates.js b/resources/assets/v3/js/pages/shared/dates.jsindex 6ef2803c51..f68025c8f6 100644--- a/resources/assets/v3/js/pages/shared/dates.js+++ b/resources/assets/v3/js/pages/shared/dates.js@@ -19,7 +19,7 @@*/import { endOfDay, startOfMonth, startOfYear, subDays } from "date-fns";-import format from "../../util/format";+import formatDate from "../../util/format-date.js";import i18next from "i18next";import { addPeriod, subtractPeriod } from "../../support/get-viewrange.js";@@ -49,8 +49,8 @@ export default () => ({submitForm() {// console.log('submitForm', format(window.store.get('start'), 'yyyy-MM-dd'), format(window.store.get('end'), 'yyyy-MM-dd'));// save form and submit for v1.- document.getElementById("customStart").value = format(window.store.get("start"), "yyyy-MM-dd");- document.getElementById("customEnd").value = format(window.store.get("end"), "yyyy-MM-dd");+ document.getElementById("customStart").value = formatDate(window.store.get("start"), "yyyy-MM-dd");+ document.getElementById("customEnd").value = formatDate(window.store.get("end"), "yyyy-MM-dd");document.getElementById("daterange-form").submit();},language: "en_US",@@ -115,56 +115,56 @@ export default () => ({let locale = window.store.get("locale");let formatString = i18next.t("config.month_and_day_fns", { lng: locale });let element = document.getElementsByClassName("daterange-holder")[0];- element.textContent = format(this.range.start, formatString) + " - " + format(this.range.end, formatString);- element.setAttribute("data-start", format(this.range.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(this.range.end, this.preferredFormat, "en-US"));+ element.textContent = formatDate(this.range.start, formatString) + " - " + formatDate(this.range.end, formatString);+ element.setAttribute("data-start", formatDate(this.range.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(this.range.end, this.preferredFormat, "en-US"));// set the current oneelement = document.getElementsByClassName("daterange-current")[0];element.textContent =- format(this.defaultRange.start, formatString) + " - " + format(this.defaultRange.end, formatString);- element.setAttribute("data-start", format(this.defaultRange.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(this.defaultRange.end, this.preferredFormat, "en-US"));+ formatDate(this.defaultRange.start, formatString) + " - " + formatDate(this.defaultRange.end, formatString);+ element.setAttribute("data-start", formatDate(this.defaultRange.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(this.defaultRange.end, this.preferredFormat, "en-US"));// generate next rangeelement = document.getElementsByClassName("daterange-next")[0];- element.textContent = format(nextRange.start, formatString) + " - " + format(nextRange.end, formatString);- element.setAttribute("data-start", format(nextRange.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(nextRange.end, this.preferredFormat, "en-US"));+ element.textContent = formatDate(nextRange.start, formatString) + " - " + formatDate(nextRange.end, formatString);+ element.setAttribute("data-start", formatDate(nextRange.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(nextRange.end, this.preferredFormat, "en-US"));// previous range.element = document.getElementsByClassName("daterange-prev")[0];- element.textContent = format(prevRange.start, formatString) + " - " + format(prevRange.end, formatString);- element.setAttribute("data-start", format(prevRange.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(prevRange.end, this.preferredFormat, "en-US"));+ element.textContent = formatDate(prevRange.start, formatString) + " - " + formatDate(prevRange.end, formatString);+ element.setAttribute("data-start", formatDate(prevRange.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(prevRange.end, this.preferredFormat, "en-US"));// generate the default range ("Today")element = document.getElementsByClassName("daterange-today")[0];let todayString = i18next.t("firefly.today");todayString = String(todayString).charAt(0).toUpperCase() + String(todayString).slice(1);element.textContent = todayString;- element.setAttribute("data-start", format(todayRange.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(todayRange.end, this.preferredFormat, "en-US"));+ element.setAttribute("data-start", formatDate(todayRange.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(todayRange.end, this.preferredFormat, "en-US"));// last 7element = document.getElementsByClassName("daterange-7d")[0];- element.setAttribute("data-start", format(last7.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(last7.end, this.preferredFormat, "en-US"));+ element.setAttribute("data-start", formatDate(last7.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(last7.end, this.preferredFormat, "en-US"));// last 30element = document.getElementsByClassName("daterange-30d")[0];- element.setAttribute("data-start", format(last30.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(last30.end, this.preferredFormat, "en-US"));+ element.setAttribute("data-start", formatDate(last30.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(last30.end, this.preferredFormat, "en-US"));// MTDelement = document.getElementsByClassName("daterange-mtd")[0];- element.setAttribute("data-start", format(mtd.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(mtd.end, this.preferredFormat, "en-US"));+ element.setAttribute("data-start", formatDate(mtd.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(mtd.end, this.preferredFormat, "en-US"));// YTDelement = document.getElementsByClassName("daterange-ytd")[0];- element.setAttribute("data-start", format(ytd.start, this.preferredFormat, "en-US"));- element.setAttribute("data-end", format(ytd.end, this.preferredFormat, "en-US"));+ element.setAttribute("data-start", formatDate(ytd.start, this.preferredFormat, "en-US"));+ element.setAttribute("data-end", formatDate(ytd.end, this.preferredFormat, "en-US"));},getNextRange() {diff --git a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.jsindex 23f89a2adf..8be8104e07 100644--- a/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js+++ b/resources/assets/v3/js/pages/transactions/shared/create-empty-split.js@@ -18,7 +18,7 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-import format from "date-fns/format";+import formatDate from "../../../util/format-date.js";export function getAccount() {return {@@ -74,7 +74,7 @@ export function defaultErrorSet() {export function createEmptySplit() {let now = new Date();- let formatted = format(now, "yyyy-MM-dd HH:mm");+ let formatted = formatDate(now, "yyyy-MM-dd HH:mm");return {transaction_journal_id: 0,description: "",diff --git a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.jsindex 00eb88f750..761655d96b 100644--- a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js+++ b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js@@ -20,8 +20,8 @@import Autocomplete from "bootstrap5-autocomplete";import formatMoney from "../../../util/format-money.js";-import { format } from "date-fns";import i18next from "i18next";+import formatDate from "../../../util/format-date.js";export function createLinkAutocomplete(fieldIdentifier, url) {const renderJournal = function (item) {@@ -34,7 +34,7 @@ export function createLinkAutocomplete(fieldIdentifier, url) {", " +formatMoney(item.amount, item.currency_code) +" @ " +- format(new Date(item.date), i18next.t("config.date_time_fns", { lng: locale }), locale) ++ formatDate(new Date(item.date), i18next.t("config.date_time_fns", { lng: locale }), locale) +"</small>");};diff --git a/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js b/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.jsindex 196904220b..049e6b1a05 100644--- a/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js+++ b/resources/assets/v3/js/pages/transactions/shared/parse-downloaded-splits.js@@ -19,7 +19,7 @@*/import { createEmptySplit } from "./create-empty-split.js";-import { format } from "date-fns";+import formatDate from "../../../util/format-date.js";export function parseDownloadedSplits(downloads, groupId) {let returnArray = [];@@ -44,16 +44,16 @@ export function parseDownloadedSplits(downloads, groupId) {current.piggy_bank_name = download.piggy_bank_name;// meta dates- current.book_date = null === download.book_date ? "" : format(new Date(download.book_date), "yyyy-MM-dd");- current.due_date = null === download.due_date ? "" : format(new Date(download.due_date), "yyyy-MM-dd");+ current.book_date = null === download.book_date ? "" : formatDate(new Date(download.book_date), "yyyy-MM-dd");+ current.due_date = null === download.due_date ? "" : formatDate(new Date(download.due_date), "yyyy-MM-dd");current.interest_date =- null === download.interest_date ? "" : format(new Date(download.interest_date), "yyyy-MM-dd");+ null === download.interest_date ? "" : formatDate(new Date(download.interest_date), "yyyy-MM-dd");current.invoice_date =- null === download.invoice_date ? "" : format(new Date(download.invoice_date), "yyyy-MM-dd");+ null === download.invoice_date ? "" : formatDate(new Date(download.invoice_date), "yyyy-MM-dd");current.payment_date =- null === download.payment_date ? "" : format(new Date(download.payment_date), "yyyy-MM-dd");+ null === download.payment_date ? "" : formatDate(new Date(download.payment_date), "yyyy-MM-dd");current.process_date =- null === download.process_date ? "" : format(new Date(download.process_date), "yyyy-MM-dd");+ null === download.process_date ? "" : formatDate(new Date(download.process_date), "yyyy-MM-dd");// more metacurrent.external_url = download.external_url;@@ -72,7 +72,7 @@ export function parseDownloadedSplits(downloads, groupId) {}// date and description- current.date = format(new Date(download.date), "yyyy-MM-dd HH:mm");+ current.date = formatDate(new Date(download.date), "yyyy-MM-dd HH:mm");current.description = download.description;// source and destinationdiff --git a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.jsindex 8bdde4f45d..0db52b30db 100644--- a/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js+++ b/resources/assets/v3/js/pages/transactions/shared/parse-from-entries.js@@ -18,7 +18,7 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-import { format } from "date-fns/format";+import formatDate from "../../../util/format-date.js";/***@@ -55,7 +55,7 @@ export function parseFromEntries(entries, originals, transactionType) {current.currency_code = entry.currency_code;// dates- current.date = format(new Date(entry.date), "yyyy-MM-dd'T'HH:mm:ssxxx");+ current.date = formatDate(new Date(entry.date), "yyyy-MM-dd'T'HH:mm:ssxxx");// console.log('Full date thing', current.date);if (i > 0 && !!returnArray[0]) {// console.log("Overrule date for entry ", i, " with ", returnArray[0].date);diff --git a/resources/assets/v3/js/pages/transactions/show.js b/resources/assets/v3/js/pages/transactions/show.jsindex 610f748c49..2dcf88c6f8 100644--- a/resources/assets/v3/js/pages/transactions/show.js+++ b/resources/assets/v3/js/pages/transactions/show.js@@ -23,7 +23,6 @@ import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";import i18next from "i18next";import Get from "../../api/model/transaction/get.js";-import { format } from "date-fns";import Alpine from "@alpinejs/csp";import "bootstrap";import L from "leaflet";@@ -31,6 +30,7 @@ import "leaflet/dist/leaflet.css";import markerIcon from "leaflet/dist/images/marker-icon.png";import markerRetinaIcon from "leaflet/dist/images/marker-icon-2x.png";import shadow from "leaflet/dist/images/marker-shadow.png";+import formatDate from "../../util/format-date.js";window.enableDates = false;@@ -89,7 +89,7 @@ let show = function () {if (Object.hasOwn(info.attributes.transactions, i)) {let current = info.attributes.transactions[i];current.dateObject = new Date(current.date);- current.dateFormatted = format(+ current.dateFormatted = formatDate(current.dateObject,i18next.t("config.date_time_fns", { lng: locale }),locale,diff --git a/resources/assets/v3/js/pages/webhooks/show.js b/resources/assets/v3/js/pages/webhooks/show.jsindex de963fedbe..120ce4cce5 100644--- a/resources/assets/v3/js/pages/webhooks/show.js+++ b/resources/assets/v3/js/pages/webhooks/show.js@@ -21,12 +21,12 @@import "../../boot/bootstrap.js";import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";-import { format } from "date-fns/format";import i18next from "i18next";import Post from "../../api/model/webhook/post.js";import Get from "../../api/model/webhook/get.js";import Put from "../../api/model/webhook/put.js";import Alpine from "@alpinejs/csp";+import formatDate from "../../util/format-date.js";window.enableDates = false;@@ -126,7 +126,7 @@ let show = function () {let current = response.data.data[i];this.messages.push({id: current.id,- created_at: format(+ created_at: formatDate(new Date(current.attributes.created_at),i18next.t("config.date_time_fns", { lng: locale }),locale,@@ -160,7 +160,7 @@ let show = function () {let current = response.data.data[i];this.message_attempts.push({id: current.id,- created_at: format(+ created_at: formatDate(new Date(current.attributes.created_at),i18next.t("config.date_time_fns"),),diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.jsindex d9106f294f..77982447a7 100644--- a/resources/assets/v3/js/shared/draw-chart.js+++ b/resources/assets/v3/js/shared/draw-chart.js@@ -21,7 +21,7 @@import Chart from "chart.js/auto";import formatMoney from "../util/format-money.js";import i18next from "i18next";-import format from "../util/format.js";+import formatDate from "../util/format-date.js";import annotationPlugin from "chartjs-plugin-annotation";Chart.register(annotationPlugin);@@ -354,7 +354,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker, col}// add the label to the arraydata.labels.push(- format(date, i18next.t("config.month_and_day_fns", { lng: locale }), locale),+ formatDate(date, i18next.t("config.month_and_day_fns", { lng: locale }), locale),);}}@@ -436,7 +436,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker, colif (drawTodayMarker && "" !== drawTodayLabel) {let locale = window.store.get("locale");let language = window.store.get("language");- let markDate = format(+ let markDate = formatDate(new Date(drawTodayLabel),i18next.t("config.month_and_day_fns", { lng: locale }),locale,diff --git a/resources/assets/v3/js/support/get-cache-key.js b/resources/assets/v3/js/support/get-cache-key.jsindex 4092967f82..c111aca34d 100644--- a/resources/assets/v3/js/support/get-cache-key.js+++ b/resources/assets/v3/js/support/get-cache-key.js@@ -18,9 +18,8 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-import { format } from "date-fns";import store from "store";-//const { createHash } = require('crypto');+import formatDate from "./../util/format-date.js";function getCacheKey(string, params) {const lastActivity = store.get("lastActivity");@@ -33,7 +32,7 @@ function getCacheKey(string, params) {continue;}if (params[key] instanceof Date) {- newParams[key] = format(params[key], "yMMdd");+ newParams[key] = formatDate(params[key], "yMMdd");continue;}newParams[key] = params[key];diff --git a/resources/assets/v3/js/util/format.js b/resources/assets/v3/js/util/format-date.jssimilarity index 100%rename from resources/assets/v3/js/util/format.jsrename to resources/assets/v3/js/util/format-date.jsdiff --git a/resources/views/profile/oauth/index.blade.php b/resources/views/profile/oauth/index.blade.phpindex 3a8ea4c9b2..50106d6a32 100644--- a/resources/views/profile/oauth/index.blade.php+++ b/resources/views/profile/oauth/index.blade.php@@ -370,7 +370,7 @@</td><!-- expires at --><td style="vertical-align: middle;">- <span x-text="new Date(token.expires_at).toLocaleString()"></span>+ <span x-text="token.expires_at"></span></td><!-- Delete Button -->