@@ -543,6 +543,15 @@ describe('Task editing', () => {
543543 } ) ;
544544
545545 describe ( 'Date editing' , ( ) => {
546+ beforeEach ( ( ) => {
547+ jest . useFakeTimers ( ) ;
548+ jest . setSystemTime ( new Date ( '2024-11-27' ) ) ;
549+ } ) ;
550+
551+ afterEach ( ( ) => {
552+ jest . useRealTimers ( ) ;
553+ } ) ;
554+
546555 const line = '- [ ] simple' ;
547556
548557 it ( 'should edit and save cancelled date' , async ( ) => {
@@ -568,6 +577,21 @@ describe('Task editing', () => {
568577 it ( 'should edit and save start date' , async ( ) => {
569578 expect ( await editFieldAndSave ( line , 'start' , '2024-01-01' ) ) . toEqual ( '- [ ] simple 🛫 2024-01-01' ) ;
570579 } ) ;
580+
581+ it ( 'should edit and save start date "today"' , async ( ) => {
582+ expect ( await editFieldAndSave ( line , 'start' , 'today' ) ) . toEqual ( '- [ ] simple 🛫 2024-11-27' ) ;
583+ } ) ;
584+
585+ it ( 'should edit and save start date "this week"' , async ( ) => {
586+ // Confirm understanding that today's date is a Wednesday
587+ expect ( moment ( ) . format ( 'YYYY-MM-DD dddd' ) ) . toEqual ( '2024-11-27 Wednesday' ) ;
588+
589+ // See https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2588
590+ // With 'only future dates' being on by default, the selection of a date
591+ // earlier than today is unexpected.
592+ // This was written with Tasks using "chrono-node": "2.3.9"
593+ expect ( await editFieldAndSave ( line , 'start' , 'this week' ) ) . toEqual ( '- [ ] simple 🛫 2024-11-24' ) ;
594+ } ) ;
571595 } ) ;
572596
573597 describe ( 'OnCompletion editing' , ( ) => {
0 commit comments