Hi for a little project I need to print date in a nice way (for example french) and I wonder if someone already did that. Right now I'm extracting behavior from Date and putting it in its own class so that I can write testAPI | datePrinter | datePrinter := DatePrinter new. datePrinter inFrench; mmddyyyy. datePrinter for: (Date year: 2016 month: 1 day: 3). self assert: datePrinter print equals: '3 Janvier 2016' I will for fun see how I can add an english and spanish version. Stef
I would suggest to look at ZTimestamp https://github.com/svenvc/docs/blob/master/neo/ztimestamp.md. Maybe it is not exactly what you want. But example based date/time formatting and parsing are really nice 2016-10-27 13:20 GMT+02:00 stepharo <stepharo@free.fr>:
Hi
for a little project I need to print date in a nice way (for example french) and I wonder if someone already did that.
Right now I'm extracting behavior from Date and putting it in its own class so that I can write
testAPI | datePrinter | datePrinter := DatePrinter new. datePrinter inFrench; mmddyyyy. datePrinter for: (Date year: 2016 month: 1 day: 3). self assert: datePrinter print equals: '3 Janvier 2016'
I will for fun see how I can add an english and spanish version.
Stef
Thanks Denis This is really a great package. I will use it and throw away what I started. (ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') format: ZTimestamp now. > THU, OCT 27 2016 (12:20:20) (ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') french; format: ZTimestamp now. "'JEU, OCT 27 2016 (12:21:34)'" Le 27/10/16 à 13:58, Denis Kudriashov a écrit :
I would suggest to look at ZTimestamp https://github.com/svenvc/docs/blob/master/neo/ztimestamp.md. Maybe it is not exactly what you want. But example based date/time formatting and parsing are really nice
2016-10-27 13:20 GMT+02:00 stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
Hi
for a little project I need to print date in a nice way (for example french) and I wonder if someone already did that.
Right now I'm extracting behavior from Date and putting it in its own class so that I can write
testAPI | datePrinter | datePrinter := DatePrinter new. datePrinter inFrench; mmddyyyy. datePrinter for: (Date year: 2016 month: 1 day: 3). self assert: datePrinter print equals: '3 Janvier 2016'
I will for fun see how I can add an english and spanish version.
Stef
French is already in and there are so great class comments that I'm crying because of outshined by beauty. Excellent job of sven as usual. french self monthNames: #( 'Janvier' 'Février' 'Mars' 'Avril' 'Mai' 'Juin' 'Juillet' 'Août' 'Septembre' 'Octobre' 'Novembre' 'Décembre' ). self weekdayNames: #( 'Dimanche' 'Lundi' 'Mardi' 'Mecredi' 'Jeudi' 'Vendredi' 'Samedi' ) Stef Le 27/10/16 à 14:27, Denis Kudriashov a écrit :
2016-10-27 14:22 GMT+02:00 stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
(ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') french
#french is your addition? or it was already supported?
On 27 Oct 2016, at 14:37, stepharo <stepharo@free.fr> wrote:
French is already in and there are so great class comments that I'm crying because of outshined by beauty.
Please, don't cry ;-)
Excellent job of sven as usual.
Thx. The ZTimestamp package also contains ZTimestampFormat (a by-example printer & parser), support for timezone aware conversions (to/from internal UTC) and NTP server time checking (contacting an external time service).
french self monthNames: #( 'Janvier' 'Février' 'Mars' 'Avril' 'Mai' 'Juin' 'Juillet' 'Août' 'Septembre' 'Octobre' 'Novembre' 'Décembre' ). self weekdayNames: #( 'Dimanche' 'Lundi' 'Mardi' 'Mecredi' 'Jeudi' 'Vendredi' 'Samedi' )
Stef
Le 27/10/16 à 14:27, Denis Kudriashov a écrit :
2016-10-27 14:22 GMT+02:00 stepharo <stepharo@free.fr>: (ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') french
#french is your addition? or it was already supported?
French is already in and there are so great class comments that I'm crying because of outshined by beauty. Please, don't cry ;-)
Excellent job of sven as usual. Thx.
The ZTimestamp package also contains ZTimestampFormat (a by-example printer & parser),
I love it :) I threw away all my code :). When I will have something running I will review the Date changes I did and ask fro review to push them in Date and Friends.
support for timezone aware conversions (to/from internal UTC) and NTP server time checking (contacting an external time service).
french self monthNames: #( 'Janvier' 'Février' 'Mars' 'Avril' 'Mai' 'Juin' 'Juillet' 'Août' 'Septembre' 'Octobre' 'Novembre' 'Décembre' ). self weekdayNames: #( 'Dimanche' 'Lundi' 'Mardi' 'Mecredi' 'Jeudi' 'Vendredi' 'Samedi' )
Stef
Le 27/10/16 à 14:27, Denis Kudriashov a écrit :
2016-10-27 14:22 GMT+02:00 stepharo <stepharo@free.fr>: (ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') french
#french is your addition? or it was already supported?
I'm a bit late to comment but just remember that in French month and day names never use a capital letter !  ----------------- Benoît St-Jean Yahoo! Messenger: bstjean Twitter: @BenLeChialeux Pinterest: benoitstjean Instagram: Chef_Benito IRC: lamneth Blogue: endormitoire.wordpress.com "A standpoint is an intellectual horizon of radius zero". (A. Einstein) From: stepharo <stepharo@free.fr> To: pharo-users@lists.pharo.org Sent: Friday, October 28, 2016 4:44 AM Subject: Re: [Pharo-users] DatePrinter
French is already in and there are so great class comments that I'm crying because of outshined by beauty. Please, don't cry ;-)
Excellent job of sven as usual. Thx.
The ZTimestamp package also contains ZTimestampFormat (a by-example printer & parser),
I love it :) I threw away all my code :). When I will have something running I will review the Date changes I did and ask fro review to push them in Date and Friends.
 support for timezone aware conversions (to/from internal UTC) and NTP server time checking (contacting an external time service).
french    self monthNames: #(      'Janvier' 'Février' 'Mars' 'Avril' 'Mai' 'Juin'      'Juillet' 'Août' 'Septembre' 'Octobre' 'Novembre' 'Décembre' ).    self weekdayNames: #(      'Dimanche' 'Lundi' 'Mardi' 'Mecredi' 'Jeudi' 'Vendredi' 'Samedi' )
Stef
Le 27/10/16 à 14:27, Denis Kudriashov a écrit :
2016-10-27 14:22 GMT+02:00 stepharo <stepharo@free.fr>: (ZTimestampFormat fromString: 'SAT, FEB 03 2001 (16:05:06)') Â Â Â Â Â french
#french is your addition? or it was already supported?
participants (4)
-
Benoit St-Jean -
Denis Kudriashov -
stepharo -
Sven Van Caekenberghe