Fixed LocalDateTime to ZonedDateTime.
This commit is contained in:
parent
be88c759fa
commit
6efdf7d39e
2 changed files with 26 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2014,2017 Christian Pierre MOMON
|
||||
* Copyright (C) 2013-2024 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of Devinsy-rss.
|
||||
*
|
||||
|
@ -18,13 +18,11 @@
|
|||
*/
|
||||
package fr.devinsy.util.rss;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* The Class RSSElement.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class RSSElement
|
||||
{
|
||||
|
@ -34,29 +32,6 @@ public class RSSElement
|
|||
private String value;
|
||||
private String[] attributes;
|
||||
|
||||
/**
|
||||
* Instantiates a new RSS element.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public RSSElement(final String name, final LocalDateTime value)
|
||||
{
|
||||
setName(name);
|
||||
if (value == null)
|
||||
{
|
||||
this.value = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.value = value.format(DateTimeFormatter.ofPattern(DATE_PATTERN));
|
||||
}
|
||||
this.attributes = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new RSS element.
|
||||
*
|
||||
|
@ -121,6 +96,28 @@ public class RSSElement
|
|||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new RSS element.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
public RSSElement(final String name, final ZonedDateTime value)
|
||||
{
|
||||
setName(name);
|
||||
if (value == null)
|
||||
{
|
||||
this.value = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.value = value.format(DateTimeFormatter.ofPattern(DATE_PATTERN));
|
||||
}
|
||||
this.attributes = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the attributes.
|
||||
*
|
||||
|
@ -190,5 +187,4 @@ public class RSSElement
|
|||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package fr.devinsy.util.rss.demo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class RSSDemo
|
|||
|
||||
//
|
||||
List<RSSElement> elements = new ArrayList<RSSElement>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
elements.add(new RSSElement("pubDate", now));
|
||||
elements.add(new RSSElement("lastBuildDate", now));
|
||||
elements.add(new RSSElement("generator", "Generated by Foo"));
|
||||
|
|
Loading…
Reference in a new issue