summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2011-07-26 22:05:14 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:57:43 +0200
commit93f1ded52049b8ff63c97a6682e028ea420ed355 (patch)
tree8d166e97da1200375ad9889059e92937269712ae /wizards
parentba5f79d6f230d06ac3ff87a43579c4ef14992ec7 (diff)
Show the date properly
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.py29
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.py5
2 files changed, 13 insertions, 21 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 3d6c0cf2c0e9..54c482cad2ee 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -5,6 +5,7 @@ from text.TextDocument import *
from common.FileAccess import FileAccess
from text.TextSectionHandler import TextSectionHandler
from TopicsControl import TopicsControl
+from datetime import date as dateTimeObject
from com.sun.star.text.PlaceholderType import TEXT
from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG
@@ -293,10 +294,11 @@ class AgendaTemplate(TextDocument):
Get the default locale of the document,
and create the date and time formatters.
'''
- dateUtils = Helper.DateUtils(self.xMSF, AgendaTemplate.document)
- AgendaTemplate.formatter = dateUtils.formatter
- AgendaTemplate.dateFormat = dateUtils.getFormat(DATE_SYSTEM_LONG)
- AgendaTemplate.timeFormat = dateUtils.getFormat(TIME_HHMM)
+ AgendaTemplate.dateUtils = Helper.DateUtils(
+ self.xMSF, AgendaTemplate.document)
+ AgendaTemplate.formatter = AgendaTemplate.dateUtils.formatter
+ AgendaTemplate.dateFormat = AgendaTemplate.dateUtils.getFormat(DATE_SYSTEM_LONG)
+ AgendaTemplate.timeFormat = AgendaTemplate.dateUtils.getFormat(TIME_HHMM)
'''
get the document properties object.
@@ -448,18 +450,13 @@ class AgendaTemplate(TextDocument):
def getDateString(self, d):
if d is None or d == "":
return ""
-
- date = Integer(d).intValue.intValue()
- self.calendar.clear()
- self.calendar.set(date / 10000, (date % 10000) / 100 - 1, date % 100)
- date1 = JavaTools.getTimeInMillis(self.calendar)
- '''
- docNullTime and date1 are in millis, but
- I need a day...
- '''
- daysDiff = (date1 - self.docNullTime) / self.__class__.DAY_IN_MILLIS + 1
- return AgendaTemplate.formatter.convertNumberToString(
- self.dateFormat, daysDiff)
+ date = int(d)
+ year = date / 10000
+ month = (date % 10000) / 100
+ day = date % 100
+ dateObject = dateTimeObject(year, month, day)
+ return AgendaTemplate.dateUtils.format(
+ AgendaTemplate.dateFormat, dateObject)
@classmethod
def getTimeString(self, s):
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 194bea1ac960..ad83b4cbc1cc 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -12,7 +12,6 @@ from common.Configuration import Configuration
from com.sun.star.container import NoSuchElementException
from com.sun.star.lang import WrappedTargetException
-from com.sun.star.util import DateTime
from com.sun.star.i18n.NumberFormatIndex import DATE_SYS_DDMMYY
from com.sun.star.view.DocumentZoomType import ENTIRE_PAGE
from com.sun.star.beans.PropertyState import DIRECT_VALUE
@@ -214,14 +213,10 @@ class TextDocument(object):
gn = xNA.getByName("givenname")
sn = xNA.getByName("sn")
fullname = str(gn) + " " + str(sn)
- currentDate = DateTime()
now = time.localtime(time.time())
year = time.strftime("%Y", now)
month = time.strftime("%m", now)
day = time.strftime("%d", now)
- currentDate.Day = day
- currentDate.Year = year
- currentDate.Month = month
dateObject = dateTimeObject(int(year), int(month), int(day))
du = Helper.DateUtils(self.xMSF, TextDocument.xTextDocument)
ff = du.getFormat(DATE_SYS_DDMMYY)