Closed asanzo closed 7 years ago
Dates have 2 constructors:
I guess that covers your needs :)
El 19 oct. 2016 21:51, "asanzo" notifications@github.com escribió:
I'd like some way to get today's date.
Thinking a bit about it, I got to this:
I'd really much like to have an object like "now", for example, in order to ask it several things:
now.date() // returns today's date now.year() // returns the year (integer) now.time() // Oh, I think Wollok doesn't have Time... Yikes, I need to open another issue. now.mockDay(d,m,y) // mocks today's date, only works in tests //etc.
It could also have shortcuts to Date's methods, like now.dayOfWeek().
Thoughts on this?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/1029, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-EZmibBynFlfQp1q-VmJdfR7OuGTwlks5q1rsigaJpZM4KbnM_ .
Yet Mati is right, I like Alf's idea, using now instead of new Date() seems more natural, what do you think?
The problem is that now would not be a stable object, i.e. each time I use it, it represents a different date, which is not true for other Date objects... so if we do that we should think that now is not a date, but another kind of object... posibly polymorphic for some uses.
I am not sure if it is going to be easy to understand.
2016-10-20 6:54 GMT+02:00 asanzo notifications@github.com:
Closed #1029 https://github.com/uqbar-project/wollok/issues/1029.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/1029#event-830054922, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OepXhL6eUNBi7v9KBIRBrYDqGQr0ks5q1vQIgaJpZM4KbnM_ .
I'd like some way to get today's date.
Thinking a bit about it, I got to this:
I'd really much like to have an object like "now", for example, in order to ask it several things:
It could also have shortcuts to Date's methods, like
now.dayOfWeek()
.Thoughts on this?