Skip to content

Commit

Permalink
Fixed locale bug and possibly "includes" error in "human friendly dat…
Browse files Browse the repository at this point in the history
…es" feature.
  • Loading branch information
ransome1 committed Mar 22, 2024
1 parent a0b46f5 commit a307e54
Show file tree
Hide file tree
Showing 8 changed files with 684 additions and 704 deletions.
2 changes: 1 addition & 1 deletion flatpak/com.github.ransome1.sleek.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<developer_name>Robin Ahle</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="2.0.12-rc.4" date="2024-03-16"/>
<release version="2.0.12-rc.5" date="2024-03-22"/>
</releases>
<url type="homepage">https://github.com/ransome1/sleek</url>
<url type="contact">https://github.com/ransome1/sleek/issues</url>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.12-rc.4",
"version": "2.0.12-rc.5",
"main": "./src/main/main.tsx",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
Expand Down Expand Up @@ -221,10 +221,10 @@
"appx"
],
"icon": "assets/icons/sleek.ico",
"artifactName": "${productName}-${version}-win.${ext}"
"artifactName": "${productName}-${version}-win-${arch}.${ext}"
},
"nsis": {
"artifactName": "${productName}-${version}-win-Setup.${ext}"
"artifactName": "${productName}-${version}-win-${arch}-Setup.${ext}"
},
"appx": {
"displayName": "sleek - todo.txt manager for Windows, free and open-source (FOSS)",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sleek",
"version": "2.0.12-rc.4",
"version": "2.0.12-rc.5",
"description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sleek
base: core20
version: "2.0.12-rc.4"
version: "2.0.12-rc.5"
summary: todo.txt manager for Linux, free and open-source (FOSS)
description: |
sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done.
Expand Down
2 changes: 1 addition & 1 deletion src/main/modules/Filters/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function applyFilters(todoObjects: TodoObject[], filters: Filters | null): TodoO

const hasMatchingValue = Array.isArray(attributeValues)
? attributeValues.some((val) => values.includes(val))
: attributeValues !== undefined && values.includes(attributeValues);
: Array.isArray(values) && values.includes(attributeValues);

return exclude ? !hasMatchingValue : hasMatchingValue;
});
Expand Down
1 change: 1 addition & 0 deletions src/renderer/Drawer/Attributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const DrawerAttributes: React.FC<DrawerAttributesProps> = memo(({
if (attributes[key]) {
const count = attributes[key].count;
const formattedValues = settings.useHumanFriendlyDates && isDate ? friendlyDate(key, attributeKey, settings.language, t) : [key];

formattedValues.forEach((formattedValue) => {
if (!processedAttributes[formattedValue]) {
processedAttributes[formattedValue] = {
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/Shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import weekday from 'dayjs/plugin/weekday';
dayjs.extend(relativeTime);
dayjs.extend(duration);
dayjs.extend(calendar);
dayjs.extend(weekday)
dayjs.extend(weekday);

const { store, ipcRenderer } = window.api;

Expand Down Expand Up @@ -58,12 +58,13 @@ export const translatedAttributes = (t: typeof i18n.t) => {
};

export const friendlyDate = (value: string, attributeKey: string, language: string, t: typeof i18n.t) => {

dayjs.locale(language)

const today = dayjs();
const date = dayjs(value);
const results = [];

dayjs.locale(language)

if (date.isBefore(today, 'day')) {
results.push((attributeKey === 'due') ? t('drawer.attributes.overdue') : t('drawer.attributes.elapsed'));
}
Expand Down
1,366 changes: 672 additions & 694 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit a307e54

Please sign in to comment.