Compare commits

..

16 Commits

Author SHA1 Message Date
renovate 6d8339fc25 chore(deps): update dependency eslint-plugin-vue to v9.20.0
continuous-integration/drone/pr Build is failing Details
2024-01-11 00:25:18 +00:00
Frederick [Bot] ce01085951 chore(i18n): update translations via Crowdin
continuous-integration/drone/push Build is passing Details
2024-01-11 00:11:57 +00:00
kolaente 96a6d43a3f
fix(quick add magic): ensure month is removed from task text
continuous-integration/drone/push Build is passing Details
Resolves #3874
2024-01-10 23:54:42 +01:00
kolaente 13d63e34aa
fix(task): don't immediately re-trigger date change when nothing changed
continuous-integration/drone/push Build is passing Details
Resolves https://community.vikunja.io/t/reminder-duplication/76/21?u=kolaente
2024-01-10 23:27:14 +01:00
renovate a8441c72b8 fix(deps): update dependency vue to v3.4.8 (#3886)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3886
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 20:16:50 +00:00
renovate 230fa6ce66 fix(deps): update dependency floating-vue to v5 (#3887)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3887
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 18:18:53 +00:00
renovate 069c491fbd fix(deps): update sentry-javascript monorepo to v7.93.0 (#3859)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3859
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 16:01:02 +00:00
renovate a9eae95d67 chore(deps): update pnpm to v8.14.1 (#3885)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3885
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 15:57:10 +00:00
renovate 50502d9d11 fix(deps): update vueuse to v10.7.1 (#3872)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3872
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 15:04:27 +00:00
renovate 18af6edc82 fix(deps): update tiptap to v2.1.15 (#3884)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3884
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 14:49:03 +00:00
renovate d048b61eb3 fix(deps): update dependency floating-vue to v2.0.0 (#3883)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3883
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 14:36:14 +00:00
renovate 996607e670 fix(deps): update dependency dompurify to v3.0.8 (#3881)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3881
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 14:35:50 +00:00
renovate e33ebe1831 fix(deps): update dependency vue-i18n to v9.9.0 (#3880)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3880
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 14:27:02 +00:00
renovate 557b0ffec7 chore(deps): update dependency node to v20.11.0
continuous-integration/drone/push Build is passing Details
2024-01-10 12:04:17 +00:00
renovate dae6cdb9d7 fix(deps): update dependency @kyvg/vue3-notification to v3.1.3 (#3864)
continuous-integration/drone/push Build is passing Details
Reviewed-on: #3864
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 11:59:31 +00:00
renovate 158e4d690f chore(deps): update dev-dependencies (#3861)
continuous-integration/drone/push Build is failing Details
Reviewed-on: #3861
Co-authored-by: renovate <renovatebot@kolaente.de>
Co-committed-by: renovate <renovatebot@kolaente.de>
2024-01-10 11:51:20 +00:00
7 changed files with 508 additions and 440 deletions

2
.nvmrc
View File

@ -1 +1 @@
20.10.0
20.11.0

View File

@ -13,7 +13,7 @@
},
"homepage": "https://vikunja.io/",
"funding": "https://opencollective.com/vikunja",
"packageManager": "pnpm@8.14.0",
"packageManager": "pnpm@8.14.1",
"keywords": [
"todo",
"productivity",
@ -52,57 +52,57 @@
"@github/hotkey": "3.1.0",
"@infectoone/vue-ganttastic": "2.2.0",
"@intlify/unplugin-vue-i18n": "2.0.0",
"@kyvg/vue3-notification": "3.1.2",
"@sentry/tracing": "7.88.0",
"@sentry/vue": "7.88.0",
"@tiptap/core": "2.1.13",
"@tiptap/extension-blockquote": "2.1.13",
"@tiptap/extension-bold": "2.1.13",
"@tiptap/extension-bullet-list": "2.1.13",
"@tiptap/extension-code": "2.1.13",
"@tiptap/extension-code-block-lowlight": "2.1.13",
"@tiptap/extension-document": "2.1.13",
"@tiptap/extension-dropcursor": "2.1.13",
"@tiptap/extension-gapcursor": "2.1.13",
"@tiptap/extension-hard-break": "2.1.13",
"@tiptap/extension-heading": "2.1.13",
"@tiptap/extension-history": "2.1.13",
"@tiptap/extension-horizontal-rule": "2.1.13",
"@tiptap/extension-image": "2.1.13",
"@tiptap/extension-italic": "2.1.13",
"@tiptap/extension-link": "2.1.13",
"@tiptap/extension-list-item": "2.1.13",
"@tiptap/extension-ordered-list": "2.1.13",
"@tiptap/extension-paragraph": "2.1.13",
"@tiptap/extension-placeholder": "2.1.13",
"@tiptap/extension-strike": "2.1.13",
"@tiptap/extension-table": "2.1.13",
"@tiptap/extension-table-cell": "2.1.13",
"@tiptap/extension-table-header": "2.1.13",
"@tiptap/extension-table-row": "2.1.13",
"@tiptap/extension-task-item": "2.1.13",
"@tiptap/extension-task-list": "2.1.13",
"@tiptap/extension-text": "2.1.13",
"@tiptap/extension-typography": "2.1.13",
"@tiptap/extension-underline": "2.1.13",
"@tiptap/pm": "2.1.13",
"@tiptap/suggestion": "2.1.13",
"@tiptap/vue-3": "2.1.13",
"@kyvg/vue3-notification": "3.1.3",
"@sentry/tracing": "7.93.0",
"@sentry/vue": "7.93.0",
"@tiptap/core": "2.1.15",
"@tiptap/extension-blockquote": "2.1.15",
"@tiptap/extension-bold": "2.1.15",
"@tiptap/extension-bullet-list": "2.1.15",
"@tiptap/extension-code": "2.1.15",
"@tiptap/extension-code-block-lowlight": "2.1.15",
"@tiptap/extension-document": "2.1.15",
"@tiptap/extension-dropcursor": "2.1.15",
"@tiptap/extension-gapcursor": "2.1.15",
"@tiptap/extension-hard-break": "2.1.15",
"@tiptap/extension-heading": "2.1.15",
"@tiptap/extension-history": "2.1.15",
"@tiptap/extension-horizontal-rule": "2.1.15",
"@tiptap/extension-image": "2.1.15",
"@tiptap/extension-italic": "2.1.15",
"@tiptap/extension-link": "2.1.15",
"@tiptap/extension-list-item": "2.1.15",
"@tiptap/extension-ordered-list": "2.1.15",
"@tiptap/extension-paragraph": "2.1.15",
"@tiptap/extension-placeholder": "2.1.15",
"@tiptap/extension-strike": "2.1.15",
"@tiptap/extension-table": "2.1.15",
"@tiptap/extension-table-cell": "2.1.15",
"@tiptap/extension-table-header": "2.1.15",
"@tiptap/extension-table-row": "2.1.15",
"@tiptap/extension-task-item": "2.1.15",
"@tiptap/extension-task-list": "2.1.15",
"@tiptap/extension-text": "2.1.15",
"@tiptap/extension-typography": "2.1.15",
"@tiptap/extension-underline": "2.1.15",
"@tiptap/pm": "2.1.15",
"@tiptap/suggestion": "2.1.15",
"@tiptap/vue-3": "2.1.15",
"@types/is-touch-device": "1.0.2",
"@types/lodash.clonedeep": "4.5.9",
"@vueuse/core": "10.7.0",
"@vueuse/router": "10.7.0",
"@vueuse/core": "10.7.1",
"@vueuse/router": "10.7.1",
"axios": "1.6.5",
"blurhash": "2.0.5",
"bulma-css-variables": "0.9.33",
"camel-case": "4.1.2",
"date-fns": "3.2.0",
"dayjs": "1.11.10",
"dompurify": "3.0.6",
"dompurify": "3.0.8",
"fast-deep-equal": "3.1.3",
"flatpickr": "4.6.13",
"flexsearch": "0.7.31",
"floating-vue": "2.0.0-beta.24",
"floating-vue": "5.0.3",
"is-touch-device": "1.0.1",
"klona": "2.0.6",
"lodash.debounce": "4.0.8",
@ -113,10 +113,10 @@
"sortablejs": "1.15.1",
"tippy.js": "6.3.7",
"ufo": "1.3.2",
"vue": "3.4.7",
"vue": "3.4.8",
"vue-advanced-cropper": "2.8.8",
"vue-flatpickr-component": "11.0.3",
"vue-i18n": "9.8.0",
"vue-i18n": "9.9.0",
"vue-router": "4.2.5",
"workbox-precaching": "7.0.0",
"zhyswan-vuedraggable": "4.1.3"
@ -154,7 +154,7 @@
"cypress": "13.6.2",
"esbuild": "0.19.11",
"eslint": "8.56.0",
"eslint-plugin-vue": "9.19.2",
"eslint-plugin-vue": "9.20.0",
"happy-dom": "12.10.3",
"histoire": "0.17.6",
"postcss": "8.4.33",

File diff suppressed because it is too large Load Diff

View File

@ -128,6 +128,10 @@ const flatPickrDate = computed({
return
}
const oldDate = formatDate(date.value, 'yyy-LL-dd H:mm')
if (oldDate !== newValue) {
return
}
date.value = createDateFromString(newValue)
updateData()
},
@ -155,10 +159,6 @@ function updateData() {
}
function setDate(dateString: string) {
if (date.value === null) {
date.value = new Date()
}
const interval = calculateDayInterval(dateString)
const newDate = new Date()
newDate.setDate(newDate.getDate() + interval)
@ -166,7 +166,6 @@ function setDate(dateString: string) {
newDate.setMinutes(0)
newDate.setSeconds(0)
date.value = newDate
flatPickrDate.value = newDate
updateData()
}

View File

@ -15,34 +15,32 @@ interface dateFoundResult {
const monthsRegexGroup = '(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)'
function matchesDateExpr(text: string, dateExpr: string): boolean {
return text.match(new RegExp('(^| )' + dateExpr, 'g')) !== null
return text.match(new RegExp('(^| )' + dateExpr, 'gi')) !== null
}
export const parseDate = (text: string, now: Date = new Date()): dateParseResult => {
const lowerText: string = text.toLowerCase()
if (matchesDateExpr(lowerText, 'today')) {
if (matchesDateExpr(text, 'today')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('today')), 'today')
}
if (matchesDateExpr(lowerText, 'tomorrow')) {
if (matchesDateExpr(text, 'tomorrow')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('tomorrow')), 'tomorrow')
}
if (matchesDateExpr(lowerText, 'next monday')) {
if (matchesDateExpr(text, 'next monday')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('nextMonday')), 'next monday')
}
if (matchesDateExpr(lowerText, 'this weekend')) {
if (matchesDateExpr(text, 'this weekend')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('thisWeekend')), 'this weekend')
}
if (matchesDateExpr(lowerText, 'later this week')) {
if (matchesDateExpr(text, 'later this week')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('laterThisWeek')), 'later this week')
}
if (matchesDateExpr(lowerText, 'later next week')) {
if (matchesDateExpr(text, 'later next week')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('laterNextWeek')), 'later next week')
}
if (matchesDateExpr(lowerText, 'next week')) {
if (matchesDateExpr(text, 'next week')) {
return addTimeToDate(text, getDateFromInterval(calculateDayInterval('nextWeek')), 'next week')
}
if (matchesDateExpr(lowerText, 'next month')) {
if (matchesDateExpr(text, 'next month')) {
const date: Date = new Date()
date.setDate(1)
date.setMonth(date.getMonth() + 1)
@ -52,7 +50,7 @@ export const parseDate = (text: string, now: Date = new Date()): dateParseResult
return addTimeToDate(text, date, 'next month')
}
if (matchesDateExpr(lowerText, 'end of month')) {
if (matchesDateExpr(text, 'end of month')) {
const curDate: Date = new Date()
const date: Date = new Date(curDate.getFullYear(), curDate.getMonth() + 1, 0)
date.setHours(calculateNearestHours(date))
@ -70,7 +68,7 @@ export const parseDate = (text: string, now: Date = new Date()): dateParseResult
parsed = getDayFromText(text)
if (parsed.date !== null) {
const month = getMonthFromText(text, parsed.date)
return addTimeToDate(text, month.date, parsed.foundText)
return addTimeToDate(month.newText, month.date, parsed.foundText)
}
parsed = getDateFromTextIn(text, now)
@ -123,7 +121,7 @@ const addTimeToDate = (text: string, date: Date, previousMatch: string | null):
const replace = results !== null ? results[0] : previousMatch
return {
newText: replaceAll(text, replace, ''),
newText: replaceAll(text, replace, '').trim(),
date: date,
}
}

View File

@ -160,7 +160,7 @@
"expired": "Žeton je potekel pred {ago}.",
"tokenCreatedSuccess": "Tu je vaš novi API žeton: {token}",
"tokenCreatedNotSeeAgain": "Shranite ga na varno mesto, ker ga ne boste več videli!",
"selectAll": "Select all",
"selectAll": "Izberi vse",
"delete": {
"header": "Izbriši ta žeton",
"text1": "Ali ste prepričani, da želite izbrisati žeton \"{token}\"?",

View File

@ -112,6 +112,16 @@ describe('Parse Task Text', () => {
expect(result?.date?.getMonth()).toBe(tomorrow.getMonth())
expect(result?.date?.getDate()).toBe(tomorrow.getDate())
})
it('should recognize Tomorrow', () => {
const result = parseTaskText('Lorem Ipsum Tomorrow')
expect(result.text).toBe('Lorem Ipsum')
const tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 1)
expect(result?.date?.getFullYear()).toBe(tomorrow.getFullYear())
expect(result?.date?.getMonth()).toBe(tomorrow.getMonth())
expect(result?.date?.getDate()).toBe(tomorrow.getDate())
})
it('should recognize next monday', () => {
const result = parseTaskText('Lorem Ipsum next monday')
@ -441,7 +451,7 @@ describe('Parse Task Text', () => {
'06/08/2021': '2021-6-8',
'6/7/21': '2021-6-7',
'27/07/2021,': null,
'2021/07/06,': '2021-7-6',
'2021/07/06': '2021-7-6',
'2021-07-06': '2021-7-6',
'27 jan': '2022-1-27',
'27/1': '2022-1-27',
@ -449,39 +459,52 @@ describe('Parse Task Text', () => {
'16/12': '2021-12-16',
'01/27': '2022-1-27',
'1/27': '2022-1-27',
'Jan 27': '2022-1-27',
'jan 27': '2022-1-27',
'Jan 27': '2022-1-27',
'feb 21': '2022-2-21',
'Feb 21': '2022-2-21',
'mar 21': '2022-3-21',
'Mar 21': '2022-3-21',
'apr 21': '2022-4-21',
'Apr 21': '2022-4-21',
'may 21': '2022-5-21',
'May 21': '2022-5-21',
'jun 21': '2022-6-21',
'Jun 21': '2022-6-21',
'jul 21': '2021-7-21',
'Jul 21': '2021-7-21',
'aug 21': '2021-8-21',
'Aug 21': '2021-8-21',
'sep 21': '2021-9-21',
'Sep 21': '2021-9-21',
'oct 21': '2021-10-21',
'Oct 21': '2021-10-21',
'nov 21': '2021-11-21',
'Nov 21': '2021-11-21',
'dec 21': '2021-12-21',
'Dec 21': '2021-12-21',
} as Record<string, string | null>
for (const c in cases) {
it(`should parse '${c}' as '${cases[c]}' with the date at the end`, () => {
const {date} = getDateFromText(`Lorem Ipsum ${c}`, now)
const {date, foundText} = getDateFromText(`Lorem Ipsum ${c}`, now)
if (date === null && cases[c] === null) {
expect(date).toBeNull()
return
}
expect(`${date?.getFullYear()}-${date?.getMonth() + 1}-${date?.getDate()}`).toBe(cases[c])
expect(foundText.trim()).toBe(c)
})
it(`should parse '${c}' as '${cases[c]}' with the date at the beginning`, () => {
const {date} = getDateFromText(`${c} Lorem Ipsum`, now)
const {date, foundText} = getDateFromText(`${c} Lorem Ipsum`, now)
if (date === null && cases[c] === null) {
expect(date).toBeNull()
return
}
expect(`${date?.getFullYear()}-${date?.getMonth() + 1}-${date?.getDate()}`).toBe(cases[c])
expect(foundText.trim()).toBe(c)
})
}
})
@ -532,6 +555,20 @@ describe('Parse Task Text', () => {
expect(`${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}`).toBe(cases[c])
})
}
it('should replace the text in title case', () => {
const {date, newText} = parseDate('Some task Mar 8th', now)
expect(`${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}`).toBe('2021-3-8 12:0')
expect(newText).toBe('Some task')
})
it('should replace the text in lowercase', () => {
const {date, newText} = parseDate('Some task mar 8th', now)
expect(`${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}`).toBe('2021-3-8 12:0')
expect(newText).toBe('Some task')
})
})
})