![]() |
#166 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Why does program: raw_field('date') return "None" while field('date') works?
$date and $$date get the same result. EDIT: It happens even if I set gui_pubdate_display_format back to default. ANOTHER EDIT: For reference, I'm using search & replace to copy to another datetime field. Last edited by ownedbycats; 10-03-2021 at 03:32 PM. |
![]() |
![]() |
![]() |
#167 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Workaround: use 'timestamp' instead of 'date'. EDIT: Also & FWIW: raw_field for dates returns 0101-01-01 00:00:00+00:00 for the unknown date because that is what is stored in the db. Up to you to know what to do with it. Last edited by chaley; 10-03-2021 at 04:25 PM. |
|
![]() |
![]() |
![]() |
#168 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you.
Are there any other columns with alias that don't work with raw_field? |
![]() |
![]() |
![]() |
#169 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Another question: Is it possible to use a template to search datetimes where the timestamp is 00:00, regardless of date?
|
![]() |
![]() |
![]() |
#170 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
You can use the following template:
Code:
program: ts = raw_field('timestamp'); time_timezone = list_item(ts, 1, ' '); time = list_item(time_timezone, 0, '+'); hours = list_item(time, 0, ':'); minutes = list_item(time, 1, ':'); seconds = list_item(time, 2, ':'); strcat(hours, ':', minutes) Instead, you can do it by copy/pasting this directly into the search bar: Code:
template:"program: ts = raw_field('timestamp'); time_timezone = list_item(ts, 1, ' '); time = list_item(time_timezone, 0, '+'); hours = list_item(time, 0, ':'); minutes = list_item(time, 1, ':'); seconds = list_item(time, 2, ':'); strcat(hours, ':', minutes)#@#:t:00:00" Code:
template:"program: format_date($$timestamp, 'hh:mm')#@#:t:00:00" Last edited by capink; 10-04-2021 at 03:47 AM. |
![]() |
![]() |
![]() |
#171 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
EDIT: The change is now in calibre source. Last edited by chaley; 10-04-2021 at 05:14 AM. Reason: Note that the change was accepted |
|
![]() |
![]() |
![]() |
#172 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
It seems to me that the format_date() answer is the right one because time zones should be accounted for. However, if you don't want that then this template removes time zone from the ISO string turning it into a local time. Code:
format_date(re($$timestamp, '(\+.*$)', ''), 'hh:mm') |
|
![]() |
![]() |
![]() |
#173 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
That makes sense. Thanks.
|
![]() |
![]() |
![]() |
#174 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you.
Any idea why the template search in #170 runs inconsistently on custom datetime fields? It only returns #fanficupdated values that are from the last few days, and nothing at all from #lastmodified. I don't think it's the formatting of the columns - it's using raw_field. |
![]() |
![]() |
![]() |
#175 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
template:"program: format_date($$timestamp, 'hh:mm')#@#:t:00:00" Code:
program: strcat($$timestamp, ' ::: ', format_date($$timestamp, 'hh:mm')) |
|
![]() |
![]() |
![]() |
#176 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question:
I had this proof-of-concept template for making different icons based on is_marked values. Code:
program: m = is_marked(); first_non_empty ( contains(m, "invalid_author_sort", 'test.png', ''), contains(m, "invalid_title_sort", 'test2.png', ''), ) Last edited by ownedbycats; 10-12-2021 at 01:21 AM. |
![]() |
![]() |
![]() |
#177 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: m = is_marked(); first_non_empty ( contains(m, "invalid_author_sort", 'test.png', ''), contains(m, "invalid_title_sort", 'test2.png', ''), if !m then 'foo.png' fi ) |
|
![]() |
![]() |
![]() |
#178 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thank you
![]() |
![]() |
![]() |
![]() |
#179 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,000
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
|
|
![]() |
![]() |
![]() |
#180 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
FWIW: this does the same thing but is less efficient because of the explicit compare: Code:
if approximate_formats() == '' then 'foo' fi |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Library Management: various questions not worth their own thread | ownedbycats | Library Management | 225 | 07-27-2025 02:07 PM |
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates | Boilerplate4U | Development | 13 | 07-07-2020 02:35 AM |
Questions on Kobo [Interfered with another thread topic] | spdavies | Kobo Reader | 8 | 10-12-2014 11:37 AM |
[OLD Thread] Some questions before buying the fire. | darthreader13 | Kindle Fire | 7 | 05-10-2013 09:19 PM |
Thread management questions | meme | Feedback | 6 | 01-31-2011 05:07 PM |