Client Difference Log
API Changes
Added Function void StudioService:OpenInBrowser_DONOTUSE(string url) {RobloxScriptSecurity}
Added Event BadgeService.OnBadgeAwarded(int64 userId, int64 creatorId, int64 badgeId) {RobloxScriptSecurity}
Added Enum DateTimeKind
Added EnumItem DateTimeKind.Utc : 0
Added EnumItem DateTimeKind.Local : 1
Moved Property EnableScriptCollabOnLoad
from: Class DataModel
to: Class StudioData
Removed Tag [NotReplicated] from Class StudioData
(Click here for a syntax highlighted version!)
Quick question: Why is BadgeService.OnBadgeAwarded(int64 userId, int64 creatorId, int64 badgeId)
is {RobloxScriptSecurity}
?
With that out of the way, thanks for the updates and keep them coming!
Functions for DateTime
are DateTime.new
and DateTime.now
. Not sure of arguments however.
Yeah for real. I was just thinking to myself how much easier this would be for creating custom badge awarded UI. But I’m gonna have to create my own AwardBadge wrapper and manually signal the client. This could have been so useful without the security.
Isn’t Enum.DateTimeKind.Local
supposed to give you the seconds in local time?
I’m getting the exact same result as Enum.DateTimeKind.Utc
. My timezone is NZDT (UTC+13). Should be 46800 seconds more?
print(DateTime.now(Enum.DateTimeKind.Local), DateTime.now())
-- 1573183453, Local 1573183453, Utc
EDIT: Apparently only affects formatting.
I’m curious about this DateTime
library.
Here are the functions so far. (that i know of)
DateTime.now(DateTimeKind kind)
Creates a DateTime with Kind of the specified type or UTC type. Time appears to be what you will get with os.time()
DateTime.new(number years,number months,number days,number hours,number minutes,number seconds,DateTimeKind kind)
Creates a DateTime with Kind of specified type or UTC type. The time created is based on the six numbers passed through, or 0. Time appears to be created in a method similar to what os.time does.
DateTime.fromUnixTimestamp(number seconds,DateTimeKind kind)
Creates a DateTime with kind of specified type or UTC type. The time appears to be the first argument (seconds) or 0. Time appears to be limited in range from 0 to 32535215999 (truncated to an integer), not sure if this is true for the other functions.
DateTime.fromIsoDate(string DateTime)
If no arguments are passed, returns nil, same thing with numbers. With strings it will try to convert it to a number from ISO format (found example “2012-12-19T06:01:17.171Z”). But with anything else, roblox crashes.
Is it intended to crash, or should I make a bug report about this?
Also, what is the point of the DateTimeKind or even this datatype itself?
DateTimeKind appears to just be a part of the DateTime data type, and doesn’t affect how the time is set in the constructors.
Also, are there any properties/functions for this DateType?
I figured out one
.Kind
Describes the DateTimeKind of the DateTime.
Is there one for the time represented by the DateTime, or do I have to extract the number with some string manipulation?
This contains all the methods/properties of DateTime I’ve found so far. Interestingly AFAIK only support for American dates when formatting.
Hopefully they either change it based on locale or switch to ISO formatting - this will confuse a lot of people otherwise as dates on the web already do
I’d imagine it’d be simple enough to convert the twelve-hour format to the twenty-four hour format manually though.
and shifting the order of the date too.
Any word on DateTime being added?
Looks like they’re making a 2nd attempt to ship it right now, this time with some adjustments to its API. The DateTimeKind enum has been removed in v421, which is currently on sitetest1.
No autocomplete data has been provided for the datatype, so I don’t currently know how it is used. Seems like some CoreScripts are using it though, so that would definitely be helpful in reverse engineering it’s behavior.
It seems like they removed DateTime.new
, added DateTime.fromUnixTimestampMillis
, DateTime.fromLocalTime
, as well as DateTime.fromUniversalTime
, and changed the api of DateTime to:
Properties:
DateTime.UnixTimestamp
: Number, describes the time of the DateTime in seconds
DateTime.UnixTimestampMillis
: Number, describes the time of the DateTime in milliseconds
Functions:
DateTime:ToIsoDate()
: returns String, the DateTime formatted in ISO format
DateTime:ToUniversalTime()
returns Dictionary, information about the DateTime
type result = {
Year:number,
Month:number,
Day:number,
Hour:number,
Minute:number,
Second:number,
Millisecond:number
}
Example:
local function toOs(dateTime)
local date = dateTime:ToUniversalTime()
local tbl = {
year = date.Year,
month = date.Month,
day = date.Day,
hour = date.Hour,
min = date.Minute,
sec = date.Second
}
return os.time(tbl),tbl
end
DateTime:ToLocalTime()
returns Dictionary, similar to ToUniversalTime but adjusted to the local time zone.
DateTime:FormatUniversalTime(String format,String locale)
returns String, using format to build the String and locale as a reference for some things when creating the string. (you can find the locales in %localappdata%\Roblox\Versions\[version]\content\configs\DateTimeLocaleConfigs
, example locale: en-us
)
locale appears to be optional, but only if you don’t use any format specifiers.
locale as a blank string appears to work, not sure what it uses in that case (probably the default locale).
Here are the formats specifier that i know about:
a
A
s
ss
S
SS
SSS
d
dd
ddd
dddd
D
DD
DDD
DDDD
h
hh
H
HH
l
ll
lll
llll
L
LL
LLL
LLLL
m
mm
M
MM
MMM
MMMM
YY
YYYY
DateTime:FormatLocalTime(String format,String locale)
returns String, similar to FormatUniversalTime but adjusted to the local time zone.
Constructors:
DateTime.now()
creates a DateTime using the current time
DateTime.fromUnixTimestamp([Number Timestamp])
creates a DateTime using the given Timestamp, or 0. Range for acceptable timestamps is -17987443200 to 253402300799
. Timestamp is in seconds.
DateTime.fromUnixTimestampMillis([Number Timestamp])
creates a DateTime using the given Timestamp, or 0. Range for acceptable timestamps is -17987443200000 to 253402300799999
. Timestamp is in milliseconds.
DateTime.fromIsoDate(string IsoDate)
creates a DateTime using the given IsoDate, if the format is invalid then returns nil. This function now correctly handles bad types, and doesn’t crash.
DateTime.fromUniversalTime([Number Years,Number Months,Number Days,Number Hours,Number Minutes,Number Seconds])
creates a DateTime using the given numbers, or 1970,1,1,0,0,0
if nothing is provided. (what each number does should be self explanitory)
DateTime.fromLocalTime([Number Years,Number Months,Number Days,Number Hours,Number Minutes,Number Seconds])
creates a DateTime similar to fromUniversalTime but adjusted to the local time zone.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.