maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
223 stars 24 forks source link

Allow <old value> short date comparisons #126

Closed tmtmtmtm closed 3 years ago

tmtmtmtm commented 4 years ago

wd uq requires both the old value to be replaced, and the new value that's replacing it.

If this is a date, then the new value can be 1908-04-14, 1908-04, or even just 1908, rather than the full '+1908-04-14T00:00:00Z'

However, this doesn't appear to apply quite so fully to the old value:

So if I try to change a date that is currently only at year precision:

wd uq 'Q333111$74845D5E-AC5C-4369-892F-4FF2A245D722' P582 1908 1908-04-14

I get:

qualifier not found {
  guid: 'Q333111$74845D5E-AC5C-4369-892F-4FF2A245D722',
  property: 'P580',
  expectedValue: '1905',
  actualValues: [
    {
      time: '+1905-01-01T00:00:00Z',
      timezone: 0,
      before: 0,
      after: 0,
      precision: 9,
      calendarmodel: 'http://www.wikidata.org/entity/Q1985727'
    }
  ]
}

So I need to do this instead as:

wd uq 'Q333111$74845D5E-AC5C-4369-892F-4FF2A245D722' P582 1908-01-01 1908-04-14

It would be nice if partial dates also worked for the old value.

maxlath commented 3 years ago

should be fixed in v15.1.2, thank to the patch in wikibase-edit: https://github.com/maxlath/wikibase-edit/commit/a41e4e8