mirror of
https://github.com/Sheldan/abstracto-templates.git
synced 2026-03-02 15:14:04 +00:00
[AB-xxx] adding exceptions for instant parsing
adding @time hint to duration parse exception text changing duration formatting to be able to handle negative durations
This commit is contained in:
@@ -1 +1,4 @@
|
|||||||
<#if days gt 1><#include "duration_days"><#elseif days = 1><#include "duration_day"></#if> <#if hours gt 1><#include "duration_hours"><#elseif hours = 1><#include "duration_hour"></#if> <#if minutes gt 1><#include "duration_minutes"><#elseif minutes = 1><#include "duration_minute"></#if> <#if seconds gt 1 || (seconds = 0 && days = 0 && hours = 0 && minutes = 0)><#include "duration_seconds"><#elseif seconds = 1><#include "duration_second"></#if>
|
<#function fits value>
|
||||||
|
<#return value != 1 && value != 0>
|
||||||
|
</#function>
|
||||||
|
<#if fits(days)><#include "duration_days"><#elseif days = 1 || days = -1><#include "duration_day"></#if> <#if fits(hours)><#include "duration_hours"><#elseif hours = 1 || hours = -1><#include "duration_hour"></#if> <#if fits(minutes)><#include "duration_minutes"><#elseif minutes = 1 || minutes = -1><#include "duration_minute"></#if> <#if fits(seconds) || (seconds = 0 && days = 0 && hours = 0 && minutes = 0)><#include "duration_seconds"><#elseif seconds = 1 || seconds = -1><#include "duration_second"></#if>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<#assign invalidFormat=model.invalidFormat>
|
||||||
|
<#include "instant_invalid_time_format_exception_text">
|
||||||
@@ -1 +1,2 @@
|
|||||||
Invalid time format: ${invalidFormat}. Valid formats are ${validFormats}. Beware to not use a space between the number and the unit.
|
Invalid time format: ${invalidFormat}. Valid formats are ${validFormats}. Do not use a space between the number and the unit.
|
||||||
|
Alternatively, you can use `@time: <duration description>` to define a duration.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Invalid format for timestamp. Either use epoch seconds (see [here](https://www.unixtimestamp.com/)) or use `@time: <time>`.
|
||||||
Reference in New Issue
Block a user