mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 15:19:41 +02:00
init 2
This commit is contained in:
commit
beed8576c2
137 changed files with 40218 additions and 0 deletions
75
frontend/src/utils.js
Normal file
75
frontend/src/utils.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
// import utils from "../../utils";
|
||||
// import Vue from "vue";
|
||||
// import Vuetify from "./plugins/vuetify";
|
||||
|
||||
const days = [
|
||||
"Sunday",
|
||||
"Monday",
|
||||
"Tueday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
];
|
||||
const months = [
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December",
|
||||
];
|
||||
|
||||
const monthsShort = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"Aug",
|
||||
"Sept",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec",
|
||||
];
|
||||
|
||||
export default {
|
||||
getImageURL(image) {
|
||||
return `/api/recipe/image/${image}/`;
|
||||
},
|
||||
generateUniqueKey(item, index) {
|
||||
const uniqueKey = `${item}-${index}`;
|
||||
return uniqueKey;
|
||||
},
|
||||
getDateAsText(dateObject) {
|
||||
const dow = days[dateObject.getUTCDay()];
|
||||
const month = months[dateObject.getUTCMonth()];
|
||||
const day = dateObject.getUTCDate();
|
||||
const year = dateObject.getFullYear();
|
||||
|
||||
return `${dow}, ${month} ${day}, ${year}`;
|
||||
},
|
||||
getDateAsTextAlt(dateObject) {
|
||||
const dow = days[dateObject.getUTCDay()];
|
||||
const month = monthsShort[dateObject.getUTCMonth()];
|
||||
const day = dateObject.getUTCDate();
|
||||
const year = dateObject.getFullYear();
|
||||
|
||||
return `${dow}, ${month} ${day}, ${year}`;
|
||||
},
|
||||
getDateAsPythonDate(dateObject) {
|
||||
const month = dateObject.getMonth() + 1;
|
||||
const day = dateObject.getDate();
|
||||
const year = dateObject.getFullYear();
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue