Unverified Commit 164d0b1d authored by Mantas Vilčinskas's avatar Mantas Vilčinskas Committed by GitHub
Browse files

v5.0.2 fix #180 by showing date instead of relative time for future dates

report by @untuned
parent 27ffa549
......@@ -284,7 +284,10 @@ cd cstate/exampleSite
3. Launch the development setup like this:
```bash
# old command
hugo serve --baseUrl=http://localhost/ --theme=cstate --themesDir=../.. --verbose
# new command partially works for v5.0.2; does not load images from static/
hugo serve --config=exampleSite/config.yml --theme=../ --contentDir=exampleSite/content
```
The main directory is the theme itself (the cState guts, basically) and the `exampleSite` folder houses all content. Use this local setup to experiment before making a PR.
......
---
title: Maintenance Window
#date: 24 Feb 21 12:35 +0200
date: 2021-02-24 10:35:00
date: 2022-02-24 10:35:00
resolved: false
resolvedWhen: 2021-02-24 12:10:00
# Possible severity levels: down, disrupted, notice
......
......@@ -158,4 +158,4 @@
- id: weeksAgo
translation: " w"
- id: yearAgo
translation: " year"
translation: " year"
\ No newline at end of file
{{ $incidents := where .Site.RegularPages "Params.section" "issue" }}{{ $active := where $incidents "Params.resolved" "=" false }}{{ $isNotice := where $active "Params.severity" "=" "notice" }}{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}{{ $isDown := where $active "Params.severity" "=" "down" }}{
"is": "index",
"cStateVersion": "5.0.1",
"cStateVersion": "5.0.2",
"apiVersion": "2.0",
"title": "{{ .Site.Title }}",
"languageCodeHTML": "{{ .Site.LanguageCode }}",
......
......@@ -3,7 +3,7 @@
* Dev toolset
*/
console.log('cState v5.0.1 - https://github.com/cstate/cstate');
console.log('cState v5.0.2 - https://github.com/cstate/cstate');
document.getElementsByTagName('html')[0].className = 'js';
/**
......@@ -80,6 +80,13 @@
if (interval > 1) {
return interval + ' {{ T "minsAgo" }}';
}
// Negative value
if(Math.floor(seconds) < 0) {
return Math.floor(seconds);
}
// Non-negative seconds
{{ if .Site.Params.skipSeconds }}
return '<1 {{ T "minsAgo" }}'
{{ else }}
......@@ -98,10 +105,14 @@
var element = elements[i];
var time = Date.parse(element.getAttribute('title'));
var html = element.getAttribute('data-time-prefix') || '';
if (!time) {
time = element.innerText;
element.setAttribute('title', time || new Date);
html += '{{ T "justNow" }}';
} else if (timeSince(time) < 0) {
html = element.innerText;
} else {
html += timeSince(time) + ' {{ T "someTimeAgo" }}';
}
......
......@@ -12,7 +12,7 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<meta name="generator" content="cState v5.0.1 - https://github.com/cstate/cstate">
<meta name="generator" content="cState v5.0.2 - https://github.com/cstate/cstate">
<meta name="theme-color" content="{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '{{ .Site.Params.brand }}';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment